According to the WordPress conditional docs it should be:
if ( is_singular( 'video' ) ) {
// do conditional stuff
} else {
//do other stuff
}
Also if you want a blank page or no content to show when the CPT is not video you don’t really need the else
so you could omit it. You could ALSO do something like:
if ( ! is_singular( 'video' ) ) {
// do nothing
} else {
//do conditional stuff
}
Related Posts:
- is_singular() not working if called via callback function of admin-ajax.php
- Conditional Tags If Custom Post Parent & Child?
- How do test if a post is a custom post type?
- Custom post type single-{custom}.php not working
- What is singular.php?
- Template for specific post of custom post type
- Pre get posts for single post
- Pull Two Posts Into Custom Post Type `single-cpt.php`
- functions.php conditional tag only for custom post type
- Exclude custom function content from certain pages
- Create sub single pages
- If on term-page -> get the current term?
- Using previous_post_link and next_post_link to wrap around post sequence
- How do I create new content pages for my Custom Post Type?
- custom post type upcoming post and past post
- Post Rank on Single Post page based on custom field
- Disable single pages and archives and keep preview
- Displaying Meta Box Image
- Custom template for post type not working
- is_page_template not working as expected
- Disable single view in register_post_type [duplicate]
- Redirect Single Post CPT (Custom Post Type) to a specific URL
- Need post_type_archive_title function but in ‘single’
- remove child post from custom post type archive
- if custom posts type exists and there are posts load script
- Need to display same custom post type on 2 different singles templates
- Made Custom Post Types, but single.php not working
- How to call custom single post?
- Custom post template for particular posts
- Excluding custom post types
- Remove single page for custom post type
- Single Template that can be applied only via URL
- How do I display tags for a custom post type single page?
- custom post type parsed as attachment
- Is there a conditional tag to determine whether the post is _any_ custom post type?
- Single template showing all posts of that type
- Programmatically rewriting slug through functions.php but returns 404
- How to display single post from custom post type loop?
- Not Able To Render Single-CustomPostType.php File
- Single page not working for custom post type
- Conditional for a Single Post That Belongs to a Category?
- Get term name without a foreach loop
- Cant get paginations on single.php to work with my custom post types
- Including all post id’s of a custom post type into an array
- How to show only the most recent post on my custom post type archive?
- Display custom post types in wp_list_pages
- Conditional Tags for specific category of custom posts
- List of users that clicked a ‘Join’ button at single post
- Move Genesis Single Page/Single Post Title
- How to check if post/page or taxonomy post is published by admin
- TinyMCE Buttons on Certain Post Type
- Inserting custom fields into single.php
- Display message if no posts in Custom Post Type loop
- Showing taxonomy terms on custom post type
- How to use single.php for creating, reading and editing Custom Posts with ACF
- How to show custom field on specific custom post type posts only when filled
- Check if custom post is a parent?
- adding custom post type “name” to single template
- trying to show single post but displays all post on a custom post type
- Custom Post Type Specific Post Template
- comments hooks on custom post type
- Conditional Statements
- If custom taxonomy else conditional [closed]
- If tag exists, then echo once
- Show specific content on parent custom post type and all children
- Function to allow single post template based on custom taxonomy?
- Conflict in function to allow single post template based on category
- WordPress giving me the index
- Loop all post on single.php
- Custom post type single page 404
- How can I write slugs / permalinks as: custom post type -> custom taxonomy and custom post type -> custom taxonomy (one CPT and many taxo)?
- How can I check the rewrite slug of current post type listing page
- get_the_terms child terms for current post/custom post only
- How to add custom PHP code in post header?
- Why custom post redirecting to index page?
- Assign for all post of a post type a specific single-post template
- custom post type single page
- custom post type single post preview for pending status
- $_SESSION Not working after X amount of page views
- Making permalink for custom post type/custom taxonomy. Stuck with 404 in the single post
- How to show data content from single page which is from custom post type?
- How to get adjacent_post custom_field value
- Single Page of Custom Post Type Not Showing the Content Of post
- Edit single page from plugin
- conditional based upon the count of current user’s published custom posts
- DIVs not showing correctly on CPT?
- Display Taxonomy Term for CPT on single-CPT.php
- How to Fix Custom WordPress Loop with Pagination on Single Post View?
- Custom metabox fields not saving when limited to a certain CPT
- Custom post type single display is ommited
- Single page problem when permalink type changed
- Two single.php files?
- Diffrent search templates for different post types
- Query child posts on parents single.php?
- Custom Post Query Combined with Conditional Tags
- How to make a list of posts displaying them 5 by 5 with a “next posts” link?
- is_singular won’t call my functions?
- strange conditional tag behaviour [duplicate]
- Can I have a specific template for products even if they are standard posts and not CPT?
- WordPress Multisite Network Shared Custom Post from Main Site using single-CPT.php