One category page, multiple headings

Conditional PHP statements can be your best friend when developing for WordPress. They allow you to display information based on certain conditions. We can use WordPress’ internal meta data, such as tags and categories, to determine what to display in certain cases. In this case, we want to simply display a unique heading for various categories.

In your category.php page you’ll want to paste this code snippet:

Here’s a quick snippet of code that allows you to include any number of different headings using one category page. Of course, adjust the category id to your own.

Classifieds

Environment & Real Estate

Hot Buzz

Product Plaza

Menu Development

This is a basic, but powerful idea. You can use “elseif has_tag(‘tagname here’))” to do the same thing with tags instead of categories for instance.

No related posts.

Comments are closed.