I mean “Full Width” like we do with pages : is_page_template( ‘Full
Width’ ) ?
-
is_page_template()
does not accept aTemplate Name
value likeFull Width
, but instead, a file name such asfull-width.php
ortemplates/full-width.php
. -
Secondly,
is_page_template()
can be used with any post types and not just Pages (page
post type), so you can also use the function to check if yourbooks
post uses a specific template. -
You can also or alternatively use
get_page_template_slug()
which is used internally byis_page_template()
, like so, where the template resides within a theme sub-directory:// Note: In the loop, you'd use get_page_template_slug( get_the_ID() ). if ( is_singular( 'books' ) && 'templates/full-width.php' === get_page_template_slug() ) { // your code }
Related Posts:
- Assign single template to multiple custom post types?
- How to set a fall back template for a custom post type in a plugin?
- Custom Post Type Archive URL takes over page URL
- Template tags to display custom post type posts in category template?
- How to specify a template for a path like http://example.com/something?
- Assign a template to a custom post type when displayed by the main loop on the home page
- Post template not applying on theme (potentially rendering as Page template)
- Custom Post Taxonomy Template Not Loading Properly
- Custom post type single page uses the right template in preview mode but shows a different template after being posted
- Values show up in custom home page but not in custom post pages
- Having some trouble properly displaying Custom Post Types in templates
- How to create custom page templates with default page layout framework?
- single-{$post_type}-{slug}.php for custom post types
- Change permalinks for posts but not for custom post types
- tag.php doesn’t work with tags on a custom post type post?
- Add Content to Page without shortcodes
- How to build a complex page structure
- Multiple Single Post templates
- Custom taxonomy query for a custom post type
- How can I fix those issues generated by the Themecheck plugin
- Why is get_post_format() for “Standard” returns empty
- Password-protect a custom rss feed
- Rename a current used post type
- How do I create new content pages for my Custom Post Type?
- single-type.php not working, delivering 404
- custom post type archive template per custom taxonomy term
- Display posts of child category in template
- custom taxonomy – Template not working
- Create separate template for shared custom taxonomy with shared terms
- wordpress 3.4 template files in subdirectories
- Lock post meta block at the bottom of a custom post type
- adding .current* tags to custom post types and taxonomies
- I am trying to output portfolio items with a picture. This code doesn’t seem to be working. What am I doing wrong?
- Help with CPT template pagination
- Page as a child of a Custom Post Type
- Merge multiple custom post types in a single archive template
- Trying to edit the single page from a Custom Post
- Plugin templates in which directory
- Using wordpress template tags within an array
- Include custom post type single template, but respect theme override of template if it exists
- Custom post type not using custom template
- Custom Post Type template stored in plugin folder not showing in post attributes dropdown
- How to clone the “Projects” Custom Post type in Divi theme
- Help need making decision. Ads rotating site on wordpress
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Not Able to Get Custom Post Type Gallery Images URL
- Display a grid of taxonomy terms at root taxonomy page
- How to use custom template files in deeper directory?
- Building a Treatments Page, What Do I Use?
- Migrating a taxonomy’s tags to the native category
- How can I get this request to use the Custom Post Type page template instead?
- Warning: Invalid argument supplied for foreach() [closed]
- Custom post type isn’t working
- Getting Un Wanted Gallery Shortcode In The Page on Loop
- Custom WP_Query doesn’t display all posts
- How can I use archive-{post_type}.php theme template?
- Show Taxonomies with admin area for custom post type?
- Pagination doesnt work in custom post type
- How do I assign a block template (.html) to a custom post type?
- Templates for hierarchical custom post type
- Custom Post Type setup
- How to get the current category with custom posts
- Custom Post Type homepage template
- Custom meta box in custom post type not working
- Create a custom taxonomy template that loops through child categories in term order?
- Display Posts Query with IF function
- Set generic reservation form for custom post type
- handling templates and widgets for custom content types
- Not Able to Add New Class To CPT Attachment Image
- Loop all post on single.php
- Manually adding current_page_parent to wp_list_pages()
- Add extra elements to the_post in a custom post_type
- Visualize info in just custom post_type in theme
- cpt not display inside nav menu
- Issue on Getting URL of Uploaded Image to a Custom Post Type
- Accessing download link from the loop with WP Download Manager Pro
- Custom Post Type has wrong label and is not found when called by a loop
- Warning , Use of undefined constant PLUGIN_PATH?
- Custom Post Type archive page listing a 404 or single post
- Too many revision when post status is changes [duplicate]
- Having issue on Loading Meta Data From CSV to CPT
- Custom taxonomy template for custom fields loop [closed]
- Single taxonomy for different custom post types
- call a function when insert and update a custom post type
- How should i name the .php file to show custom posts under a taxonomy’s term?
- creating a custom post template
- 2 custom posts types, in their own columns, one pagination for both
- How to make a custom search template for custom taxonomy?
- DIVs not showing correctly on CPT?
- Custom post type with custom taxonomy permalinks
- template structure for CPT not clear
- Search form to find custom meta box generated data
- Why is my custom form saving with ‘autodraft’ as title and slug?
- query_post while (have post) get_template_part()?
- Template with Custom Post Type (Custom Tables) does not work
- Most appropriate way to display CPT’s by children terms of custom taxonomies while retaining desired permalink structure?
- CPT Template Option to Top
- WordPress search results grouped by post type
- REQUIRED: The theme uses the register_post_type() function, which is plugin-territory
- Default WordPress Query for a Specific Custom Post Type URL