我正在尝试修改Genesis选项卡插件,以便在每个选项卡上显示多个帖子。在过去的一个小时里,我一直在徒劳地尝试,但不幸的是,我的一点PHP知识并不能解决这个问题。以下是当前代码,该代码应返回5个帖子标题(\'posts\\u per\\u page\'=>5),但仅显示一个:
// 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;
我猜这与have\\u posts()位于if()语句中有关,但我可能完全错了。有人能给我指出正确的方向吗?在这里搜索有助于我将插件中一些贬值的标签换成更新的版本,但不幸的是,我无法解决手头的“真正”问题。谢谢
杰米