Quantcast
Channel: Lecciones Prácticas
Viewing all articles
Browse latest Browse all 33

WordPress custom archive for specific category [SOLVED]

$
0
0

This days i’ve been designing a website in which there is a need for different archive views for each category of posts.

For this example, we will asume that we have three post categories defined:
1) uncategorized
2) blog
3) product

First thing is to find the category ID’s. You can do this by going to Posts > Categories and hovering your mouse over the ‘Edit’ link next to each category and pay attention to which URL it points to. In my example, for ‘product’ category I get this link:
http://www.mysite.com/wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=3&post_type=post.

This means that product category has id number 3.

Knowing this, how do we make a wordpress archive for specific category of posts?

- Clone the (general purpose) archive.php in your theme folder. Name it category-.php, with being the category you want to customize it for. For instance, category-3.php
- Edit category-3.php and add the custom code.

You can read more about WordPress template hierarchy here.

The post WordPress custom archive for specific category [SOLVED] appeared first on Lecciones Prácticas.


Viewing all articles
Browse latest Browse all 33

Trending Articles