![](/img/trans.png)
[英]Limit the number of words of a post shown on the home page of a wordpress blog
[英]How to limit number of post archives in category on home page wordpress
我一直在寻找这个解决方案的很多小时,却找不到答案。
在我的主页上,我有一个部分显示最近的帖子,其中显示了永久链接标题和节选。 它显示了该特定类别中的所有已发布帖子,但我需要将帖子数量限制为3。
我已经尝试了一切,但没有任何效果。 我的索引文件指向loop-index.php文件,尽管我尝试更改index.php文件以及loop-index.php和functions.php文件中的代码,但我一直在编辑代码。
这是代码的链接: https : //gist.github.com/rwilki/3ab9192955895891f43ac01
在While循环之前添加此参数。
query_posts('post_type=post&posts_per_page=2&orderby=menu_order&order=DESC');
while (have_posts()) : the_post(); unset($prev); $m++;
Set YOur lImit posts_per_page=2 //change your value
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.