• Resolved anima9

    (@anima9)


    I don’t have background knowledge on php but I can follow instructions to the bone so please take your time to help me for this one simple request.

    This is my website. I’ve set my homepage to show only 9 posts. When I click on my Categories, like kettlebell, I am shown the same number of posts.

    What I want to know is how I can show ALL posts per category in one page. I’ve been trying to do this thing on cPanel where you’re supposed to paste

    query_posts( array ( ‘category_name’ => ‘my-category-slug’, ‘posts_per_page’ => -1 ) );

    in wp-includes/query.php but I don’t how to get it to work. This is the part where I usually get stuck. This is my reference:

    https://codex.www.ads-software.com/Function_Reference/query_posts

    I also tried to use the List Post Categories plugin but it didn’t work the way I wanted it to work so I want to try the PHP thing first and I also don’t like installing too many plugins.

    Any help or recommendations will be appreciated

Viewing 2 replies - 1 through 2 (of 2 total)
  • You never should be making changes in WordPress core files to do anything you want. Reason being is that they will get overwritten with the next WordPress update. To do what you’re trying to do, you’ll want to open the template controlling the category pages within your theme. This could be category.php or archive.php, depending on your theme structure. Look for the beginning of the loop there and above that, put:

    <?php global $query_string;
    query_posts( $query_string . ‘&posts_per_page=-1’ ); ?>

    Thread Starter anima9

    (@anima9)

    OMG! I AM SO HAPPY! T_T I’ve been reading and trying various things for the last 3 hours >.< You are the best person in my world right now!!! THANK YOU!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to display all posts in one category?’ is closed to new replies.