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 :
category-example.php
category-1.php
The same applies for tag and author archives.
If you want to create a custom category page for all categories, simply name your file:
category.php
For all archives including categories, tags and author archives, name your file:
archive.php
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
Upload the file from the download folder 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.
Styling
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.
Archive Type Templates For Genesis
- Template For Custom Archive Page Loop In Genesis
- Genesis Archive Page Template – Fully Customizable
- Use Custom Fields Outside The Content Area & Loop On Archives
- Genesis Sample Theme – Custom Archive Page Template With Different Hero Image
- Testimonials Category Archive Page Template For Genesis
- Show All Posts In All Categories
- Genesis: Basic Custom Attachment Page
- Create Custom Post Type With Archive Template
- List All Post Titles Only in Genesis
Was This Tutorial Helpful?