I'm trying to modify the Genesis Tab plugin to show more than one post per tab. I've tried in vain for the past hour, but my little PHP knowledge just isn't cutting it unfortunately. Here is the current code, that should be returning 5 post titles ('posts_per_page' => 5), but is only showing one:
// Loop through all chosen categories
foreach ( (array) $cats as $cat ) :
if ( ! $cat ) continue; // skip iteration if $cat is empty
// Custom loop
$tabbed_posts = new WP_Query( array( 'cat' => $cat, 'posts_per_page' => 5, 'orderby' => 'date', 'order' => 'DESC' ) );
if ( $tabbed_posts->have_posts() ) : while ( $tabbed_posts->have_posts() ) : $tabbed_posts->the_post();
echo '<div id="cat-' . $cat . '" '; post_class( 'ui-tabs-hide' ); echo '>';
if( ! empty( $instance['show_title'] ) ) :
printf( '<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute( 'echo=0' ), get_the_title() );
endif;
echo '</div><!--end post_class()-->'."\n\n";
endwhile; endif;
endforeach;
I'm guessing it's something to do with the have_posts() being within the if() statement, but I could be entirely wrong. Is somebody able to point me in the right direction? Searching here has helped me swap out some depreciated tags that were in the plugin for more recent versions, but unfortunately I haven't been able to solve the 'real' issue at hand.
Thanks!
Jamie
var_dump
of the$tabbed_posts
before theif
?$instance
var.