If you are using WordPress for blogging or an online magazine you may not need to filter out posts from the archives or searches. However WordPress have become very popular for business style websites and on this kind of websites clients may ask for having both news on the front page and a traditional blog where news are excluded… or other similar setups. The news on the front page can be picked out by using a special category and a great free plugin like WP Category Post List Widget. I use this plugin a lot on websites I develop, and I will go into a bit more detail on how it works in a minute. The blog however should be a standard blog with all posts except those posts that have been added to the front page news category. This is a bit more tricky and in most cases it requires several code updates in the theme to exclude certain posts from archives, RSS, widgets etc.  Let me show you a simple solution where no code changes are needed.

[exec]$filestr = file_get_contents(‘http://www.tripwiremagazine.com/googleadsensebelowmoretag.inc’);echo $filestr;[/exec]

Disclosure: Please note that some of the links below are affiliate links and I will earn a commission if you purchase through those links (at no extra cost to you). I recommend that you do your own independent research before purchasing any product or service. This article is not a guideline, a recommendation or endorsement of specific products.

The setup for this “how to”

For this article I set up a simple demo site with the following content:


  • Front Page News
  • Blog category 1
  • Blog category 2

Posts (in the other they are listed below)

  • Blog post cat 2
  • Front Page News [1-4]
  • Blog post cat 1

Creating the news widget

There are many plugins available you can use to list items in a category. There is even one included with WordPress, but it is really limited in how you can customize it. I’m personally using WP Category Post List Widget as it has a lot of flexibility and allow me to create reuseable themes controlling how the presentation of the widget will be.

Once installed you will find a new widget called “WP Category Post List”.


I’m going to cover a few settings but I recommend you check out the documentation for the plugin – also quite good and can be found here.

[1]: When inserted into a sidebar the following options will be available. As you can see, it is possible to use WordPress tags to make e.g. the title and teaser text have dynamic text.

[2]: This is where you choose the category to feature posts from.

[3]: Here you pick a CSS theme. If you are able to edit CSS yourself, you can find the themes at the following path within your WordPress site: /wp-content/plugins/wp-category-posts-list/static/css

[4]: This is where you control the number of posts to show in the widget

[5]: It is possible for to specify what information to show about the post e.g. date, author, excerpt

[6]: You can use this to show links below the list to the feed and category page. NB! If you use the filtering explained below this may not work.

[7]: The plugin allow you to add thumbnails to the list and set up how the ordering of the list will be. The images are pulled from the post “Featured image”.

All on all you have a lot of options to control the output.

This is a few simple examples of the widget in action:



Filtering the news from the archives

For filtering out posts, categories, pages etc. I will introduce you to a simple free plugin called Simply Exclude. Once installed you will find a new menu item called “Simply Exclude”. Here you set up the overall filtering properties. It may be a bit difficult to understand what the settings do, but basically you are required to decide whether to use “Include only” or “Exclude” for the different types of content. These decisions control the actions you make on e.g. on individual categories on the categories page or individual posts.


So let say you kept the default exclude setting for categories. On the categories page you can then decide for a specific category where you exclude it. In this case I set up the Front Page News category to be excluded from everythig except the search.


The result….If the filter had not been applied the four news posts would have been part of the blog listing and appear between the two posts. The news as you can see only show up in the news widget.


The only possible draw back I can see right now is the fact that showing a list of news in archive view is hard when the filters exclude the posts from the archives. This could be useful if you have a news widget showing 4 items and want to add a “read more news” link below the widget. I’m still working on a solution for this and I will update the post when I figure out the right solution. It is of course possible to use a plugin to generate the full list of news, but in most cases it would be a more clean solution to use the build in wordPress loop to list the news category.

When adding posts to widgets like I showed here you may want to control the order they are listed in. I recently described a useful solution for reordering posts with drag & drop that you may find useful for this.

I hope you found this how to useful. Please share it with your friends and coworkers and leave a comment if you have anything to add.

[exec]echo get_avatar( get_the_author_email(), ’80’ );[/exec]

Author : Lars Vraa


Pin It on Pinterest

Share This

Share This

Share this post with your friends!

WordPress Appliance - Powered by TurnKey Linux