There’s at least 3 options to choose from:
You can use the single CPT file name which you can grab from the source code in the body classes or a custom class which can be added directly to the single-cpt.php file or using a functions file with conditional tag.
.single-cpt {
your declarations
}
Or add directly to single-cpt.php file
add_filter( 'body_class', 'wpsites_cpt_body_class' );
function wpsites_cpt_body_class( $classes ) {
$classes[] = 'your-single-cpt-class';
return $classes;
}
Or with conditional in functions file
add_filter( 'body_class', 'wpsites_cpt_body_class' );
function wpsites_cpt_body_class( $classes ) {
if ( is_singular('your-cpt') ) {
$classes[] = 'your-single-cpt-class';
return $classes;
}
}
Related Posts:
- Show Similar Post Titles ( Similar to Stack Exchange )
- How do I unlock a post programmatically?
- Delete Post With No Traffic?
- Automatically Creating Posts for Popular Forum Topics or Products [closed]
- WP get_permalink Return Wrong URL
- Is there a plugin to display certain posts on certain pages? [closed]
- plugin for wp_list_categories with posts
- Replace existing pages with new pages, keep menu links
- Use plugin or custom post type for game score functionality
- Output HTML only on individual post view
- View Private Published Page with URL Code (no login required)
- Add category selection to custom post type (plugin)
- Redirect to another page using contact form 7? [closed]
- How to backup single post in wordpress [closed]
- Moving FB comments at the end of page
- How can i summerize posts or news automatically in word press site?
- Delete data from custom table when deleting a post
- Link Posts to External URL
- Posts are deleted everyday at night
- Issues with Post 2 Post Plugin
- Get page type to display content
- Does anyone have the Custom Post Permalinks plugin from John P. Bloch? [closed]
- Looking for membership style plugin with edit option [closed]
- How to check if the product is in a certain category on a single-product.php in Woocommerce?
- Delete tables from database when deleting plugin
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Custom comment type maybe?
- Posts wont expire
- Publish Post After Click On A Link
- Enable comments for post with comments meta box removed
- Is there an action that is called when a post is restored from the trash?
- How to get last_updated and newest_blogs in WP 3.0
- Adding “ ” before the last word in multiple defined areas with a plugin
- How to change ID of an attachment in wp_posts and its related tables correctly?
- New post notification plugin [closed]
- Will Flutter work with WordPress 3.0?
- Adding Plugin-specific Fields with wp_insert_post()?
- Cron job not firing
- Anonymous Postings
- Can’t delete Draft Post [closed]
- wp_generate_attachment_metadata is creating an empty array
- Post category with counts been display like a menu
- Post custom Data value in The Events Calendar plugin [closed]
- Contributive page where people logged in can write
- Use of Templates in a Plugin
- Custom wordpress Theme and Plugin repository
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- Recent posts per category loop?
- Problem of encoding characters (apostrophes) in my posts publications
- WordPress as template engine
- How to change the post form from plugin?
- Allowing users to Sign-up > Login > Post articles that need approval
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- WordPress – source link plugin – how to modify it?
- Is there a plugin or a way in the wordpress that would let us have different versions of a post or page accessibe to users?
- Minimize and Uglify WordPress Plugin Files
- download button for audio file in post [closed]
- Print posts category or tag as a formatted journal
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- Post deleted in trash [closed]
- How to relate 3 wordpress components with each other (Create database relationships)
- problem with register_activation_hook in plugin
- How display specific category post to specific users?
- Download counter for skydrive shared files in wordpress
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- How to keep plugin (media-sync) running even the tab is closed?
- Is it possible to pin a post in second position from top
- page duplication on wordpress that wont stop
- How to access a wordpress plugin page or add posts without doing it from the WordPress dashboard?
- How can I see $post object in frontend from functions.php?
- Move plugin pages from dashboard to front-end
- Allow members to create groups on my site
- save short-code in my custom plugin settings problem missed something
- Installation failed, trying to install ANY plugin
- register_activation_hook not creating table
- WordPress delete cookie
- multiple string replace of post’s content for large data
- Multi-site error wordpress after migration
- How to force regenerate thumbnails in WordPress posts?
- Update Plugin Without Overwriting Custom Settings
- Where to insert customize_register in wordpress plugin
- Serialize $_POST global in wordpress
- Display_rows() and column_cb() strange behaviour
- Directory structure for plugin changes
- How can I pass value to function in add_menu_page?
- disable lightbox in a plugin [closed]
- get post excerpt by query
- Need Help Creating a Multi-Step, Video-Guided Enrollment Site
- User specific content (posts) / limiting visibility
- Remove the ‘Press This’ Tool
- How wordpress plugin hooks works? [duplicate]
- Selling Downloadable Products [closed]
- How to delete remain data in WP database after deleting custom post via admin interface
- How can I modify the colors of my theme for a single section of my site? [closed]
- How to generate a responsive output from plugin?
- Need help saving input fields for Security Deposit plugin in WC Vendors page
- Shortcode returning specific content of a post
- How to Add Extra Text In WordPress Title Before Post Publish
- How to update a lot of posts on my WP site with additional content?