在主页之后的页面上显示额外的文章
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在主页之后的页面上显示额外的文章相关的知识,希望对你有一定的参考价值。
This is designed to show 10 posts on each of the pages after the home/blog page when the home page only shows 5 (because if you just use posts_per_page=10 without the offset you will lose the most recent posts numbered 6-10 in between the first and secon home/blog paged).You can tweak it to different numbers, but you'll need to change the maths (10 * ($page - 1) - 5) to suit.
function custom_queries() { global $query_string; if (is_home()) { $page = get_query_var('paged'); if ($page > 1 ) $offset = 10 * ($page - 1) - 5; else $offset = 0; if ($page > 1 ) query_posts($query_string . "&posts_per_page=10&offset=$offset"); } } add_action('thesis_hook_before_content', 'custom_queries');
以上是关于在主页之后的页面上显示额外的文章的主要内容,如果未能解决你的问题,请参考以下文章
我用thinkphp做了个网站但是只显示主页,其他页面不显示