If you hook onto a later action such as template_redirect
, you should be able to check the query vars to determine if your specific post type is being viewed.
add_action( 'template_redirect', 'example_callback' );
function example_callback() {
if( is_single() && get_query_var('your-posttype') )
wp_enqueue_script( .. your args .. );
}
Or alternatively like this…
add_action( 'template_redirect', 'example_callback' );
function example_callback() {
if( is_single() && get_query_var('post_type') && 'your-type' == get_query_var('post_type') )
wp_enqueue_script( .. your args .. );
}
Hope that helps.
Related Posts:
- How come Featured Image isn’t showing up in my Custom Post Type?
- How to use a custom post type archive as front page?
- Set posts of a custom post type to be private by default?
- Custom post status not working
- clients list using wordpress
- Find callback function for custom taxonomy metabox
- Date archives for custom post type
- How can I add dropdown widget/box to admin post page?
- Using Default WordPress Custom Header Image Crop Feature in a Post Type / MetaBox
- Limiting number of custom posts shown on taxonomy page
- Multiple Content Block
- Append taxonomy terms as class names in markup?
- Allow Users Access to Custom Post Type Only
- Display only custom post type count for current author on the “At a Glance” dashboard widget
- How to get Custom Post ID by adding filter to child theme’s function
- Loop through posts of a custom-post-type (event) and create .ics (iCal) file?
- When ‘is_post_type_archive()’ return true?
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- GravityForm: Populate Dropdown with custom post type [closed]
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- right_now_content_table_end function not working?
- WooCommerce product search titles only
- Notice: Undefined index: suppress_filters
- Custom Taxonomy Permalinks Redirection
- Add custom column in custom post type edit page
- I did group my search results by post type, but how can i give each of them its own order?
- custom post type not showing in menu
- Change custom post type slug from plugin options
- Change CPT archive title
- I need to add endpoint for wordpress categories
- How to target a specific custom post type post and its all children and grandchildren?
- Featured image overlay when changing post status
- ACF field key/value to show on taxonomy list
- Query taxonomy of taxonomy of custom post type
- Hide a widget inside a div on specific type of post
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- How to change permalink to include custom post type
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Add term to custom post type on draft
- Different Category system needed for the Custom Post Type
- Global custom meta box
- Template not working for the custom Post type
- Featured Image field not appearing in Custom post type
- PHP question: how to combine syntax?
- Loop increase number
- ACF in wordpress
- Change Slug of a Custom Post Type
- How to inherit field value from parent post into in child / sub post
- Custom post type’s posts are not showing anywere but in xml sitemap
- Removing full title and breadcrumb header container for a specific post type
- Get current user id
- Show current user posts in custom post type query
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- Custom post type in Custom widget – $listItem
- Custom posts – tag pagination
- Adding custom post formatting options in custom post types
- Custom meta box in custom post type not working
- Display author box on just certain category posts?
- Function to add custom HTML into head in custom post-type list page
- Submit Custom Postypes from frontend
- Need help with Custom Post Types and Taxonomies
- Conflict in function to allow single post template based on category
- redirect after submiting post for review
- How to divide Subcategories into pages of parent category wordpress
- set object terms after some some time of published post – functions.php
- update custom taxonomy custom fields
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Pagination not working in custom post type. Help
- How to add specific terms in a custom post type?
- Limit custom post type to the authors only on front-end!
- Urgent – WordPress keeps creating posts
- Create posts inside CPT post
- ACF field check value of field on all other articles
- Problem with multi checkboxes value in metabox?
- Create dynamic logo carousel without using any plugin
- Send mail to author when custom post type is saved
- Recovering data about custom post and taxonomy types
- wordpress does not see the correct custom taxonomy hierarchy
- is using “require_once” in wordpress theme affect the speed ???
- Custom permalink rewrite rules – how do I fix this?
- Populate custom post type/custom fields from an external database
- How to sort custom post’s category by id from the theme’s function.php?
- Work and Display a Custom Post Type as a normal Post
- Custom Field to post_title
- Post Custom & Taxonomy 404 error
- How To Display Category list from Portfolio post type plugin?
- Featured image in custom post is being disabled
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- WP_Query function for custom post type
- Modify shortcode to work with custom taxonomies and slugs
- Calling the first & last post by category in custom post type
- Query custom post type and showing its content
- Allow authors to create article image
- Code in custom widget queries all posts, when it should only query the current post
- Comments are not working on Custom Post Type
- How to make a non-public post on wordpress approval?
- how to display custom taxonomies in front page
- wordpress category form fields in popup
- How to use wp_set_object_terms depending on page ID?
- How to display *block number* instead *date value* on WordPress posts?