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

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

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

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems