• I have a blog where I blog about three topics, and I assign each a category based on that.

    1. Personal
    2. Computers
    3. Theology

    My main blog just shows everything, however, I want a dedicated page with a list of all posts in each category. How can I do this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Here’s what I’d recommend:

    1. Make a separate page for each category
    2. Duplicate your index.php file once for each category and name it something like index-personal.php
    3. Insert the following code at the beginning of each duplicate, replacing “personal with the category name”:

      <?php
      /*
      Template Name: Personal
      */
      ?>

    4. Then, for each duplicate of your index php file, alter the loop to show results only from that category (I can describe this in greater detail if you need me to)
    5. Select the appropriate page template for each category page using the “quick edit” feature under the “pages” tab.

    Let me know if you need any further clarification.

    Thread Starter brentontherefore

    (@brentontherefore)

    Hi, thanks so much you’re awesome and that is helpful.

    I am really looking just to have a list of links to the different posts, not the actual posts themselves.

    In looking around I found wp_get_archives() which does nearly what I want to do:

    <?php wp_get_archives(‘type=postbypost&limit=25’); ?>

    This posts a list of the last 25 posts by title, and includes links to them. However, it gets ALL of them, but I want it to only get certain categories.

    create three files category-personal.php, category-computers.php and category-theology.php.

    Now copy the all code from archive.php file and paste in three files.

    Hope that it will work.

    Thread Starter brentontherefore

    (@brentontherefore)

    actually, the theme i’m using didn’t have an archives.php, but i added it… now what? is it supposed to show up somewhere?

    where are you showing the three category? Link would be like this https://www.x.com/personal

    Thread Starter brentontherefore

    (@brentontherefore)

    that doesn’t work. I have my test environment installed at /ann and i created a file category-sermons.php:

    https://brentonstrine.com/ann/sermons

    upload .htaccess file.

    Thread Starter brentontherefore

    (@brentontherefore)

    yeah, the .htaccess file is there.

    –EDIT–
    whoops, it was empty. put up a real one, but it’s directing to the root domain now.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How do I make lists of posts based on category?’ is closed to new replies.