Use WordPress Plugin PostLists to Show Posts From a Tag or Category

Posted by

Do you want to highlight some posts with their url in WordPress? There is a cool plug-in to to do so. You can show the list containing any number of posts in a widget section. You can place the list at any position but generally, the sidebar widget is the best place to show the special posts’ list.

WordPress Tip: How to Add Extra Widget Section In WordPress Blog

PostLists allows to decide you whether to select the category or tag from where you want to fetch the posts and show them in your WordPress page templates. As example, in Tech-Tips-Geek we’ve used PostLists to show the latest 7 posts from the WordPress category at the sidebar.

Here I’ve described about a brief details of how to use the plug-in PostLists in your WordPress blog.

[Related: Exclude the posts of a certain categories from WordPress blog home page.]

At first, download PostLists plug-in and upload the extracted folder in your server at the location /wp-content > Plugins. Activate that plug-in from the WordPress admin panel. Now you can find that there has been added an extra option “PostLists” in the “Posts” box in your admin panel.

Now you have to configure your list. To do so follow the steps below.

1. Click on “PostLists” under “Post” box from the admin panel. You will see the list configuration page.

2. By expanding the drop-down box you can see there are many standard lists are defined there. But they are not going to help us more. We’ll have create a new list and organize it as we like. So chose “+New List” from the drop-down menu and click on “Select”.

3. Now give a name of the list that you want to create.

Note that, I’ve given the name  “myxyz” instead of the category name or tag name or any meaningful name. Why? Because, if so then the PostLists plugin will print the list where ever it will find that word and will mess up your blog pages. So give the name as odd as possible.

4. Look at the “This is the html code template for each entry” field. The default list configuration is given there. But you can change it by the supported place holders.

5. Scroll down the page and select the maximum and minimum number of posts, the category or tag from where you want to show and so on

6. After configuring your list, click on “Save this new list” button. Also check the box tagged as “Keep lists and settings also if plugin gets deactivated (recommend)” to keep this settings saved yet the PostLists plug-in has been deactivated.

Add the syntax to show the list in your template

Open the theme template where you want to show the list. You can open that with Notepad or edit directly from your admin panel. For instance, we take the template as sidebar. So open the sidebar.php template and put the following line at your preferred position.

<?php if( function_exists("pl_postlist") ) pl_postlist("Myxyz");?>

Where “Myxyz” is the list name that you’ve created earlier. Save the template. You can now design the view of the list.

There are many options by which you can customize your list. But frankly, it is not possible to describe all those features here. But if you need any further assistance for advanced configuration of the list, just put your comments in the comment section. We’ll be back with your issue as soon as possible.

This post was written by Tanmay

Reader Comments

  1. Paulhac

    There’s one thing i want to figure out : when I put a tag value in “Show only posts with this tag” AND a category value in “Show only posts of this category” the result is nothing !
    how can I do that? thanks in advance!

    Paulhac

    WordPress 3.0.1
    PostLists 2.0.2

  2. Tanmay

    If you’ve configured postlist properly then possibly the tagged post is not in the category you specified i.e in that category there is no post tagged with the tag name you put.

  3. WhiskeyJim

    Your site and your programming are very well done. You have a talent, and I wish good luck to you.

    And the concept of this plug-in is excellent. WordPress as a CMS needs people like you.

    Question: Can you choose the ‘current category’ in the “Show only posts in this category” section? Doing so allows a single page to display differently depending on the post.

  4. Tanmay

    Hey Jim I’m not the programmer of this plugin. LOL.. I just grabbed that from wordpress.org and described here about the usage procedure.

    Answer: This plugin can not help too much in that issue, I think. But things can be done. Just tweak the code.

  5. Paulhac

    Yes, there are tagged posts in the category I specified.
    It looks like it were not possible to filter posts with a specified category AND with a specified tag inside that category