Maddos integration with WP Posts Carousel plugin

WP Posts Carousel is the highest rated Owl carousel plugin for WordPress, and works great with the Maddos theme.

owl-772x250

It’s very customizable, and I recommend using the following code snippet to allow you to choose a Maddos sized image in the WP Posts Carousel plugin options.

add_filter( 'get_sources', 'wpc_jph_get_sources' );
function wpc_jph_get_sources( $sources ) {
  $sources['single-thumb'] = 'Maddos Single Thumb';		// <-- 540 wide
  $sources['hover-thumb'] = 'Maddos Hover Thumb';		// <-- 260 wide
  $sources['related-thumb'] = 'Maddos Related Thumb';	// <-- 200x200 (recommended)
  return $sources;
}

carousel_thumb

Other useful code snippets for WP Posts Carousel with the Maddos theme:

// select X totally random posts
// for this to work have to hack WP Post Carousel file carousel-generator.class.php line ~184 and add case:
//                case "random":
//                    $query_args['orderby'] = 'rand';
//                    break;
add_filter( 'wpc_get_shows', 'wpc_maddos_get_shows' );
function wpc_maddos_get_shows( $types ) {
  $types['random'] = __('All Posts - Random', 'wp-posts-carousel');
  return $types;
}

// link Carousel entry to Site Url instead of post permalink.
// for this to work have to hack WP Post Carousel file carousel-generator.class.php line ~249 and add filter:
// $post_url = apply_filters('wpc_item_permalink', get_permalink($post->ID) );
add_filter( 'wpc_item_permalink', 'wpc_maddos_use_site_url' );
function wpc_maddos_use_site_url( $link ) {
  $site_url = function_exists( 'get_field' ) ? get_field( 'site_url', $post->ID ) : $link;
  return $site_url;
}

// only show posts that have a featured image!
add_filter( 'wpc_query', 'wpc_maddos_query_thumbnails_only' );
function wpc_maddos_query_thumbnails_only( $query_args ) {
  $query_args['meta_key'] = '_thumbnail_id';
  return $query_args;
}

// only show these post IDs - useful if featuring certain sites
#add_filter( 'wpc_query', 'wpc_maddos_query_featured_posts' );
function wpc_maddos_query_featured_posts( $query_args ) {
  $query_args['post__in'] = array( '815', '756' );
  return $query_args;
}

John Holt

I’m a software engineer and web designer in Fort Pierce, Florida (winter) and Franklin, New Hampshire (summer). Super Blog Me is a space where I can brainstorm my ideas on WordPress development, interface design and other things I do with my life.

2 Comments:

  1. How many sites support with one license? I wanna buy one.

Leave a Reply

Your email address will not be published.