WordPress.org

Forums

Change number of posts displayed on category pages? (5 posts)

  1. EC2337
    Member
    Posted 1 year ago #

    I am trying to find out how to increase the number of posts that are displayed on category pages.

    I understand and am familiar with how to change the number in the Settings > Reading area. But that doesn't seem to be the problem. That's set to 16 and works fine if you click on the "blog" link on my main menu.

    Where it doesn't work is any of the category pages. All of those display 7 posts, followed by the navigation link for older posts.

    This doesn't seem to be a theme issue. I contacted the developer of my theme (Encounters: Child) who had never run into this issue before.

    I realize it might be a plugin issue or something I've done on my end but I'm at a loss as to how to fix it.

    Thanks to anyone who can assist me.

    Link to the blog portion of my site:

    http://asktheastrologers.com/blog/

    and to a category portion:

    http://asktheastrologers.com/tarot-scopes/

  2. Mrinal Kanti Roy
    Member
    Posted 1 year ago #

    Hi,

    As you thought it's something wrong with plugins, so why not go with a simple solution!

    At first deactivate all the plugins of your site & then check the category page, if it's showing perfect, then re-activate the plugin one by one & check the site after each activation.Find the conflicted plugin by following this process.

    Try not to use the conflicted plugin & find an alternative if possible.

  3. EC2337
    Member
    Posted 1 year ago #

    Of course I had done that. or thought I had. I'm not well versed in the word press world, which is why I braved the murky waters that are these forums for suggestions. Thanks for yours.

  4. C W
    Member
    Posted 1 year ago #

    I'm seeing sixteen posts on every category page.

  5. saleho
    Member
    Posted 6 months ago #

    You need to edit functions.php in your theme, add this piece of code

    function number_of_posts_on_archive($query){
        if ($query->is_archive) {
                $query->set('posts_per_page', 15);
       }
        return $query;
    }
    
    add_filter('pre_get_posts', 'number_of_posts_on_archive');

    As you see, the code above is for archive page which contains category, tag, date, etc and will show 15 posts for each page.

    If you want to change the number of posts in category page only then you can change the code like this

    if ($query-> is_category()) {
                $query->set('posts_per_page', 15);
       }

    [links moderated - see http://codex.wordpress.org/Forum_Welcome#Signatures

Topic Closed

This topic has been closed to new replies.

About this Topic