admin管理员组文章数量:1430480
I am new to wordpress and coding. I created this website: /
I have six archive pages, and I am posting different posts under each category. I just realized that each page is only showing 10 posts.
I tried the following but failed: Setting > Reading > changed Blog pages show at most to 50.
Is it possible to have an unlimited number of posts under each page?
I am new to wordpress and coding. I created this website: http://www.psychiatryeducationforum/
I have six archive pages, and I am posting different posts under each category. I just realized that each page is only showing 10 posts.
I tried the following but failed: Setting > Reading > changed Blog pages show at most to 50.
Is it possible to have an unlimited number of posts under each page?
Share Improve this question edited Nov 29, 2016 at 8:16 Nathan Powell 1,6151 gold badge13 silver badges31 bronze badges asked Nov 28, 2016 at 22:33 Singh HSingh H 111 gold badge1 silver badge2 bronze badges 5- How are you listing posts on these pages? I can see that a page template is being used, which would normally just show the page title and content. Is there some kind of shortcode added to the content area of a page such as this one?: psychiatryeducationforum/psychiatry-in-depth – Dave Romsey Commented Nov 28, 2016 at 22:39
- Hi Dave. This is how I am posting:- Create new post > assigning specific categories (which I have created for each page) so that post goes to specific page only. I hope this answers. I don't remember adding some kind of shotcode. Thanks. – Singh H Commented Nov 28, 2016 at 23:59
- Hi Singh, it seems that your page template is doing something special. To troubleshoot further, I think we'd you to post the code for the page template. I did some more digging though, and I see that your site does have category archives, and they are listing many more posts: psychiatryeducationforum/category/psychiatry-in-depth So, perhaps another alternative is that you could change your main menu so that it uses the category archive links, like the one I referenced in this comment. – Dave Romsey Commented Nov 29, 2016 at 0:05
- I tried posting the page.php code but it is too big for word count. I will try to change the main menu. Can you assist me with basic overview on how to change the menu so that it uses the category archive links. I am a newbie here. apology for asking basic questions. – Singh H Commented Nov 29, 2016 at 0:56
- You can try going to Appearance > Menus, then add a custom link to one of your category archive pages, e.g. psychiatryeducationforum/category/psychiatry-in-depth, but there are many ways that the menu could be configured. – Dave Romsey Commented Nov 29, 2016 at 1:16
6 Answers
Reset to default 2It seems your theme (or one of your plugins) has reduced the query to 10 posts per page.
Otherwise, changing the option in the Settings page has to change the number of posts per page.
Check code of your theme and remove posts_per_page parameter of queries (If queries have been modified, and this parameter was set).
To have all posts of your blog in one page, you have to set posts_per_page
parameter of queries to -1.
To make any custom queries obey your settings, you have to set the posts_per_page
parameter in query arguments to get_option('posts_per_page')
.
You should search your theme files for the pre_get_posts action hook. This hook allows manipulation right before the query is executed. The query object is created at this point, so the backend setting could be overwritten by this hook.
Note: To query all posts you could set the posts_per_page
variable to -1
I did changed the posts_per_page
query to -1
.
I did Setting > Reading > changed Blog pages show at most to 99, but no changes.
I also tried adding this code in posts.php, but no changes.
function hwl_home_pagesize( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( is_home() ) {
// Display only 1 post for the original blog archive
$query->set( 'posts_per_page', 1 );
return;
}
if ( is_post_type_archive( 'movie' ) ) {
// Display 50 posts for a custom post type called 'movie'
$query->set( 'posts_per_page', 50 );
return;
}
}
add_action( 'pre_get_posts', 'hwl_home_pagesize', 1 );
can you try this
query_posts( array(
'posts_per_page' => 15
) );
Add below code in functions.php
add_filter('pre_get_posts', 'limit_change_posts_category');
function limit_change_posts_category($query) {
if ( $query->is_category() ) {
$query->set('posts_per_page', 100);
}
return $query;
}
You can use the following plugins for display maximum no. of post in single page with category 1. Category Post List Widget, 2. Category Posts Widget, 3. Posts From Category
本文标签: archivesIncrease 10 post limit per page
版权声明:本文标题:archives - Increase 10 post limit per page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745546867a2662742.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论