Custom WordPress Blog Post, Page and Category Templates

3d Animation

To create a custom WordPress template for blog posts and blog archives you simply copy the existing template file in your theme directory. Add the small bit of code below, name the new blog post template and then save this under a new name. For single posts you target the single.php for archives and categories select the archive.php. For custom page templates target the page.php file.

Example code for Single Blog Post and Custom Page Templates, this replaces the small bit of code at the top of the page.


<?php
/*
 * Template Name: Custom Post Name Here
 * Template Post Type: post, page, product
 */
  
 get_header();  ?>

Custom Category Archive Pages

Simply copy the archive.php and rename this to the archive category id.