How to display the latest post from each category using WordPress query_posts

Wordpress Tips Tricks Tutorials

By default WordPress presents all the posts in the blog sorted descending to post time at the home page. Well in some circumstances you might not want to have that layout on your home page. Lets say you have five categories and you want to pull the latest post from each of the categories and display it on your home page. Now that wont work out with the default WordPress home page layout. Here is a simple tip to work around that situation. WordPress has a function to filter out the posts depending on certain criteria, the function is known as . The template function query_post has several parameters that enables you to filter the posts for the WordPress . Below is an example of pulling the latest post from a category and display it at the blog home page. The function can be modified by many parameters. Here I’m displaying only few parameters in action.

How to use different header for categories and pages in WordPress

wordpress tips tricks

Don’t you come across situations like you need to implement multiple header types for different categories? I’m sure you do. Here is a simple yet effective solution to work out the issue to implement multiple header types for different categories. For more conditional tags you can look up to .

First of all create the header files for each categories. Also have one header file as the default one. These files will be included from the main header.php file. Consider the code below for the your WordPress theme header.php file.

Read moreHow to use different header for categories and pages in WordPress