1

I am new to wordpress and coding. I created this website: http://www.psychiatryeducationforum.com/

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?

  • 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.com/psychiatry-in-depth – Dave Romsey Nov 28 '16 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 Nov 28 '16 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.com/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 Nov 29 '16 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 Nov 29 '16 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.com/category/psychiatry-in-depth, but there are many ways that the menu could be configured. – Dave Romsey Nov 29 '16 at 1:16
2

It 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').

  • I did set posts_per_page to -1 but still no changes in number of posts per page. Do I have to insert new code. I am a newbie here. Thanks. – Singh H Nov 29 '16 at 22:46
  • @SinghH Somewhere in your code must be making changes to posts_per_page. You should look into hooks too, because your theme may use hooks and filters to change (or enforce) query parameters. – Hadi77 Mar 17 '17 at 23:53
0

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

  • Thanks. I did that. changed variable to -1. Still no change in number of posts. I also found media_per_page set at 20. I will try changing that to -1 and hope this works. – Singh H Nov 29 '16 at 22:43
0

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 );
-1

can you try this

query_posts( array(
    'posts_per_page' => 15
 ) );
  • 1
    There is already an automatic query on the archive pages that can be changed. Overwriting this query with a new one, especially by using query_posts(), is a bad idea. Never do that. Also, please explain how your code snippet would solve the problem to have an unlimited number of posts under each page. – fuxia Nov 29 '16 at 10:26
-1

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 make your answer better by explaining "why" this answers the question. – butlerblog Apr 27 at 11:13
-3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.