您可能应该考虑使用Wordpress的内置查询来实现这类功能,并为自己创建几个自定义循环。可能有一些插件可以为您做到这一点,但一般来说,最好尽可能减少对第三方脚本的依赖。
要执行上述操作,您可能需要这样一个循环(将此循环放入您的主页模板):
// This is where we set up the parameters for your custom loop. In the example below you would want to swap out the category ID numbers with the IDs for your News and Events cateogries
<?php $my_query = new WP_Query( \'cat=2,6&post_per_page=4\' );?>
// The Loop
<?php if($my_query->have_posts()) : while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
//Add template tags and other stuff here that you want to show up for each post
<?php endwhile; else: ?>
<p>Sorry - No posts to display.</p>
<?php endif; wp_reset_query();?>
要实现另一个循环,您可能需要与上述内容大致相同的内容,但是,您需要稍微更改第一行。类似的操作应该可以(将其放入自定义页面模板中):
//This adds in the pagination that you require.
//Once again, you will need to modify the category ID to match the ID of the one you want to display.
//You can also tweak the other parameters to suit your requirements
<?php $paged = ( get_query_var(\'paged\') ) ? get_query_var(\'paged\') : 1;
query_posts( array( \'cat\' => \'12\', \'posts_per_page\' => 10, \'orderby\' => \'date\', \'order\' => \'DESC\', \'paged\' => $paged ) ); ?>
可在此处找到有关WP查询的更多信息:
http://codex.wordpress.org/Class_Reference/WP_Query
希望这有帮助!