• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Load Special Template For One Specific Single Custom Post Type

Regardless of the name of your custom post type, you can load a special template which only displays on one single post when using custom post types.

For non custom post types, you would simply include the slug or post i.d in the file name of the template according to the WordPress Template Hierarchy however this isn’t supported for CPT’s so you need to use the single_template filter.

Here’s 3 working examples which you can use in:

  • A plugin – Loads the template from the plugins root directory with the file name plugin-cpt-template.php
  • A child theme – Loads the template from the parent themes root directory with the file name parent-cpt-template.php
  • A parent theme – Loads the template from the child themes root directory with the file name child-cpt-template.php

Register for full access

Related Tutorials

  • 5 Ways To Use a Single Post Template for Custom Post Types
  • Using Different Custom Single Post Templates

Custom Post Type

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags