Support » Plugins » Index list of posts by category

  • whooven


    I’d like to provide my readers with a list of posts by category…an index page, though calling it that seems confusing since the website home page is the “index” page.


    Weather (category name)
    – Sure is sunny today (post name)
    – Stormy weather this week
    – Hurrican season begins
    Gardening (next category name)
    – Harvesting watermelons
    – Planting a money tree

    So this would be a single new page in the blog that would list all posts by category (all categories on one page, as in the example above), all on one page, much like the index section of a book. I need category name (with link) and post title (with link) and that’s it.

    I can copy the category template page and remove the “content” tag but how do I get it to display all categories and how can I remove the limit on how many posts are shown?


Viewing 7 replies - 1 through 7 (of 7 total)
  • I found your request intriguing, and did some poking around. My searches returned that indeed, there wasn’t a simple option for this, so with the help of alphaoide via IRC, I put together a plugin to accomplish this. If you’d like to test it out, and let me know if it works for you (it worked fine on my test server), I’ll go ahead and release it.

    I created a page template in my theme, and added the function to the template.
    The function is <?php mb_cat_archive(); ?>

    You can download the file at

    At this point, it simply outputs the category name in an h2 tag, then lists the post titles below with a link to the posts’s permalink. If it seems at all useful, or popular, I’ll look at doing more with it (this is my first plugin, so I’m not sure what/how/ to do next 🙂 )
    I’m sure some fancy AJAX to hide the posts until you click the category would be nice for larger blogs and the ability to change the h2 tag in the function would be a start…

    Thread Starter whooven


    Super cool of you to work on this. I’ve tried this on 4 of my blogs and the best I can get is this error:

    Fatal error: Call to undefined function: get_categories() in /homepages/27/serveraddress/htdocs/myaccount/mysite/blog/wp-content/plugins/cat_archive.php on line 30

    where “serveraddress”, “myaccount” and “mysite” are all specific to me – I anonymized them for this discussion.

    I uploaded and activated the plugin (tried in WP 2.02 and 2.04), copied the default page template, renamed it “blogindex.php” and added the required page template code at the top. This is my page template:

    Template Name: Blog Index

    <?php get_header(); ?>

    <!– content …………………………… –>
    <div id=”content”>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>


      <?php wp_list_pages(‘title_li=&child_of=14&depth=1’); ?>

    <h2><?php the_title(); ?></h2>

    <?php the_content(); ?>
    <?php mb_cat_archive(); ?>

    <?php endwhile; ?>

    <?php endif; ?>

    </div> <!– /content –>

    <?php get_footer(); ?>

    Any ideas?

    Hmm, I wonder if that’s a function only in WP 2.1, which is running on my test site. I’ll do some investigating, and get back. THanks a ton.

    That is indeed the case, it’s a new function that will be in 2.1, which is where I was testing the plugin. I’ll use the original code I was working with, and update the plugin tomorrow.

    Sorry about that, bear with me.

    Thread Starter whooven


    Hey no problem, thank YOU. And when this tests out okay I have a slight variation to suggest, one that should actually be quite easy.

    Thread Starter whooven


    I just came across a great plugin that does a pretty good job of providing this feature. It’s called Sitemap Generator from Dragon Design. I almost didn’t try it because I already use a google sitemap generator but this one is different. It’s not for google, it’s for your users, creating an easily readable list of posts by category.

    Plug location:


    I’ve tested it and it works great for me. However if you want to press ahead and finish your idea miklb, I’ll be happy to test it with you. Might work better.

    Also, a variation I’d like to see is the ability to produce a similar page organized by post month. So:

    January 2006
    – Post name 1
    – Post name 2
    – etc.
    February 2006
    – Post name 1
    – etc.

    Thread Starter whooven


    Okay, figured out how to do a list of posts by month. Someone else has a plugin that fits:

    The Clean Archives plugin works great and produced just what I was looking for. Activate plugin, paste a php code into a new page and you’re done. To paste the php code, you’ll probably have to create a page template and then a page that uses that template. Instructions for how to do this are in docs.

    So I have everything I need now. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Index list of posts by category’ is closed to new replies.