The easiest way to create custom category archive pages is to copy an existing file from your parent theme and rename it. You will then need to modify the code in the file according to your own requirements.
Simply copy either the archive.php or category.php file from your parent theme and paste it into your child themes folder then change the file name if needed.
If you only want a custom category page for one category, you have 2 choices.
Use the category slug or i.d like this for the file name and WordPress will load the template according to the Template Hierarchy :
The same applies for tag and author archives.
If you want to create a custom category page for all categories, simply name your file:
For all archives including categories, tags and author archives, name your file:
All files should be uploaded to your child themes root directory unless your theme uses a specific folder to store templates.
Genesis archive.php example
- Create a new file using a code editor like Notepad++
- Copy the PHP code from the view raw link in the Gist labelled archive.php
- Paste the code into your new file
- Upload the file to your child themes root directory
Here’s what the above code generates in the Enterprise Pro child theme by StudioPress as an example:
- Entry Header – Entry Title
- Entry Header – Entry Meta (Post Info)
- Featured Image – Post Thumbnail
- Post Excerpt
- Entry Footer – Entry Meta
The template code shows you how easy it is to add and remove both add_actions and remove_actions to customize the output of your different archive page elements.
You can then use the page i.d to style your archives differently or add a custom body class like this directly to your custom archive file or conditionally from your functions file:
In Genesis, you can add the code to generate a custom body class directly to your archive file otherwise you can add it to your child themes functions file with a conditional tag after the function when using other themes.
More Page Templates For Genesis
- Genesis Archive Page Template – Fully Customizable
- Testimonials Category Archive Page Template For Genesis
- Show All Posts In All Categories
- Genesis: Basic Custom Attachment Page