Page Template To Show All Posts From Categories With Category Description

This tutorial shows the featured image and post title from the most recent posts in every category on one page like this:

category-description

Note: You want to make sure your featured images are all the same size otherwise regenerate thumbnails, or remove the entry class from the code which prints the white background.

You can also exclude, include and customise what posts and categories you want displayed simply by changing the settings in the code.

Code Installation

  1. Using a code editor, create a new file in your child themes root directory named custom.php and add the code to the file.
  2. Select the Template from the drop down menu under the Page Attributes met a box on your Edit Page screen.

Here’s the code:

Related Tutorials


Comments

4 responses to “Page Template To Show All Posts From Categories With Category Description”

  1. Tony Brennan Avatar
    Tony Brennan

    Hi Brad,
    How would I get this template to work for 1 category only? I have 4 categories, so ideally I’d like to have 4 templates.

    Thanks
    Tony

    1. Brad Dalton Avatar
      Brad Dalton

      You could set the category paremeter like this:
      [code]’cat’ => value,[/code]

      Swap out the $value for the category slug or category id.

      Or you could simply use column classes to display your category archives in columns.

      You can also use the template hierarchy and create category files for each using the slug like category-news.php where news is the name of the category.

  2. […] Page Template To Show All Posts From Categories With Category Description […]

  3. […] Page Template To Show All Posts From Categories With Category Description […]

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.