WP SITES

2948 Tutorials & 189 Plugins

Template To Display Posts From Specific Sub or Child Categories

This template enables you to display a list of sub categories with the name of the sub category followed immediately by all posts attached to the sub category like this:

Update : Here’s a newer solution which enables you to use any taxonomy type and display each post in any type of grid layout using even or uneven widths & heights.

child-categories

The code prints the:

  • Child category name for each category you add using its i.d.
  • Description for each child category, if added.
  • All posts assigned to each child category.

You can control exactly which sub categories are included or excluded using any of the get_terms parameters.

'include' Array or comma/space-separated string of term ids to include.

Use like this:

$include = array( '56','57' );

In the above code swap out the sub category i.d’s with your own. Each i.d should be wrapped in single quotes like this ‘1’ and seperated by a comma.

Here’s the template you can download and add to your child themes root directory.

Related Tutorials

Was This Tutorial Helpful?