WP Categories and Posts

WP Categories and Posts is an extension of the core WordPress function called


This plug-in adds in a template tag you can use to display categories and sub categories and the posts underneath those categories.

For working examples, please see the following pages:

Here are some  screenshots as well.





Please download the file WP Categories and Posts v1.0 from the WordPress plugin directory.


Installation is simple. Just unzip into your plug-ins folder and activate the plug-in. From there, you may call the function


from within your WordPress page.

An example page template called sitemap.php is included in the zip file. You can copy this file into your themes directory and use it as a page template for your sitemap if you wish.


The function by itself will return the categories and posts. It will accept most of the same arguments as wp_list_categories, but not all of them. One argument that I noticed that didn’t work was showcount.


This plugin is provided as is, but I will try to answer most of your questions. If you have any questions, suggestions or bug reports please add them in the comments below.

Latest News

All latest news, updates and releases are published here.

36 thoughts on “WP Categories and Posts”

  1. @Sylvie

    Do you mean by using the sitemap.php template file? If so you have to use the classes for your theme or make sure not to define any classes so that it uses the default.

    Another way to run this is to install the ‘RunPHP’ plug-in and then just create a page and add the function to the page content.

    I am going to work on making this plug-in work right inside the content area of a page or post, hopefully next version will have this ability so that you won’t need to use a function or a separate template.


  2. Let me try again, since the PHP code wasn’t posted …

    I am attempting to modify my Archives page. However, I am stuck.

    I basically want to use the WP Categories and Posts plugin to list each my categories with ALL the posts under that. I am almost there. The page currently looks like this.

    The PHP code that drives this in in the Archives.php file. It now looks like this:


    What do I need to do to modify this so that it displays ALL my posts under each category? Right now it is defaulting to the last 3 posts.

  3. Hey Michael,

    Since your PHP code didn’t post here I can’t tell how you are calling it, if you want send me your code via email phil [@] philmcdonnell.com and I will have a look.

    As is the plugin should list all categories and posts under them like in my sitemap page on this site.

  4. Michael;
    I’d hoped to produce a sitemap page and uploaded the plugin and copied the sitemap.php to both the themes folder and the folder of the theme (being unsure which was required).When it came to the function call, frankly, I got lost. I’ve managed a functional xml sitemap, but would like to make this work as well.

  5. Pete,

    You can simply upload the plugin to the wp-plugins folder then activate it.

    Once that is done you can add the function call to any page in your theme, the sitemap.php file is for older wordpress installs, I need to update it.

    The function can be called this way:

    < ?php if (function_exists("ronalfy_list_categories_and_posts")) { ronalfy_list_categories_and_posts(); }?>

    The easiest way to install this plugin is to use the run-php plugin which allows you to select a check-box on your post or page to allow php within the body of the post. The you can just insert the function call right in your post.

    Let me know if that helps at all?


  6. I’m finding something to customize my categories and posts and I found your plugin.
    I have been wondering about this topic, so thanks for writing. I’ll certainly be subscribing to your posts.

  7. Hello,

    I’ve just upgraded to WP 2.8, and my custom category listing now displays “No categories” everywhere wp-categories-and-posts is in use. It was displaying as intended under 2.7.1.

  8. @ Justin:

    I am using WordPress 2.8.2 and all seems to be working fine, have a look at the sitemap page here. Let me know if you are still having problems.


  9. Hi Phil,
    I have some category icons I want to display to the left of the category names in the Category and Posts listing. Ordinarily I would have replaced-



    if (function_exists('put_cat_icons')) put_cat_icons( wp_list_categories('title_li=&orderby=order&category_orderby=order'.'&echo=0')); else wp_list_categories('title_li=&orderby=order&category_orderby=order');

    Can you advise how I should modify your plugin to make this work?

    • Howard,

      Did you try to use your function with my plugin call? Something like…

      put_cat_icons( ronalfy_list_categories_and_posts() );

      Let me know if that works for you, if not can you email me the code for your put_cat_icons function and I will see if I can get it going for you.

  10. Hello and good day! After hours of finding the perfect archiving plugin I need, I finally found yours and it looks great! But I wanted to delete the sidebar from the page because my page.php doesn’t include a sidebar. But my archiving page includes a sidebar and I tried to delete the tag from sitemap.php. Still doesn’t work. Please help me out. Thanks a lot!

    – – – – EDIT – – – –

    I already got it to work. Sorry xD

  11. Greetings

    I just found your plugin – just what I needed. Thanks

    Just one thing though, for my usage, I would like to limit the number of posts under each category. How do I do that?

    Also would like to edit the category font.



    • @Jill,

      I am glad the plugin is helpful to you.

      There is no built in limit variable yet, I plan on adding that. You can limit it yourself in the code by changing the numberposts=10000 number to the number of posts you want to show. You can find it around line 130 in the plugin code:

      //Get all posts
      $posts = get_posts('numberposts=10000&category=' . $category->cat_ID);

      You can style the font by adding your own class to the css and then adding a DIV before your function call:

      < ?php if (function_exists("ronalfy_list_categories_and_posts")) { ronalfy_list_categories_and_posts(); }?>

      Hope this helps…

      • Thanks so much Phil for that lightening speed reply!

        Your suggestions worked like a charm. I very much appreciate your work and support.

        Have a super day!

  12. Phil, I am thinking to use it as related posts plugin for post instead of as a sitemap for the whole website.

    Besides, my blog got a few hundred posts, and display them all in a page is too long.


    • Why not just grab one of the related posts plugins? There are a bunch available and they do work pretty well. As for using this plugin for that I would need to know what you want to display under it? Do you want only subcategories of the current category to appear or do you want post titles of the current category to appear?

      Like I said it would be best to use a plugin that is made for related posts.


  13. Many related post plugin are using tags and contents to organize related posts which I think is not necessary for my blog.

    There are related post plugins display posts under its current category and subcategories, but related posts are not well organized under its categories as your plugin. That is why I think your plugin is better than theirs.

    • Well first thanks for the compliment… I will see what I can do over the weekend to make this work for you. I will email you if I find an answer for you and will post here as well.


  14. I’d like to display all the post posts for just one category. Is that possible? I am using wp_list_categoes in a dynamic Nav bar and only one of the categories needs to link to each individual post directly.
    Some way to exclule listing posts for certain / most categories?

  15. Hey Phil,

    I was wondering if this plugin could be used to list all of the posts in a certain category at the bottom of a category page. Some of my categories have hundreds of posts and I am looking for a way to list them all in the category page or tag page.


  16. Hi there, I’m using this sitemap plugin now. Please may I know how to remove the date that appears after the post title in the sitemap? Which line(s) do I need to remove from the plugin editor?

    Thank you!

  17. Hi Phil,

    I’ve already used your plugin and it works but I need to customize it.
    How do I display only the categories and can I display only a specific category?

    Thanks a lot! More power to you!


Comments are closed.