Creating a Template for Each Post Category

Socrates Premium Wordpress Theme

Socrates Premium Wordpress Theme

Get Instant Access

You don't have to limit yourself to creating a static-page template for your site. No, you can completely gorge yourself at the table of WordPress templates and create unique sections for your site, as I did (with an espresso chaser, of course).

Figure 14-10 shows my design portfolio. Design Portfolio is the name of a category that I created in the WordPress Dashboard. Instead of using a static page for the display of my portfolio, I used a category template to handle the display of all posts made to the Design Portfolio category.

You can create category templates for all categories in your blog simply by creating template files with filenames that correspond to the category ID numbers and then uploading those templates to your WordPress themes directory (see Chapter 12). The logic to this is as follows:

Figure 14-10:

My Design Portfolio page, using a category template file.

Figure 14-10:

My Design Portfolio page, using a category template file.

✓ A template with the filename category.php is a catch-all for the display of categories.

✓ Add a dash and the category ID number to the end of the filename (as shown in Table 14-1) to specify a template for an individual category.

✓ If you don't have a category.php or category-#.php file, the category display pulls from the Main Index template (index.php).

Table 14-1 shows three examples of the category template naming requirements.

Table 14-1 WordPress Category Template Naming Conventions

If the Category ID Is...

The Category Template Filename Is...

1 category-1.php

2

category-2.php

3 category-3.php

3 category-3.php

Was this article helpful?

0 0
Auto Blogging Profits

Auto Blogging Profits

No guesswork! Follow a proven strategy to building profitable autoblogs in a few short hours. How to quickly monetize your autoblogs with insanely profitable cash funnels. The fastest way to drive unstoppable, targeted traffic to your autoblogging network, FREE. Powerful resources that will save you loads of time, while automating the entire process.

Get My Free Ebook


Post a comment