WordPress Category Page

From Wiki @ Karl Jones dot com
Revision as of 19:01, 25 October 2016 by Karl Jones (Talk | contribs) (Karl Jones moved page Category Archive Page to WordPress Category Page)

Jump to: navigation, search

In WordPress, a Category Archive page (or simply Category page) displays Posts which belong to a specific WordPress Category.

Description

Category pages are based on WordPress Templates.

Template hierarchy

The first step in modifying what happens when someone visits a Category page is to figure out which of your theme's files is going to be used to display the posts. This is known as the WordPress Template hierarchy.

In the case of categories, the hierarchy is fairly simple. For instance, suppose the slug of the Category in question is news and the Category ID is 6. The Template Hierarchy specifies that WordPress will use the first Template file it finds in your current Theme's directory from the following list:

  • category-slug.php
  • category-ID.php
  • category.php
  • archive.php
  • index.php

That is, if you do not have a category-slug.php (lets say category-news.php), WordPress will check for a category-ID.php (like category-6.php), and so on.

So, if you want to make the Category whose ID number is 6 look different from what it is currently (and different from other Category pages), you would want to create a category-6.php file.

If you want to make all Category pages look different from other archive pages (such as date and author archives), then you would want to create or modify the category.php file.

If you want to make changes to the look of all archive pages, you can create or modify the archive.php file.

If you modify the index.php file, you will affect your entire blog.

If you need to create a new file, it is a good idea to copy it from the next file in the hierarchy that exists. For instance, if you want a special display for Category 6, begin by copying the category.php file, or if you don't have one, use archive.php, and so on.

See also

External links