I think there are many ways to do so. Here is a simple solution for the loop-template:
<?php
// set css class, if post-title is 'diamond'
$cpt_class = ('diamond' === strtolower( $post->post_title ) ) ? 'post-is-diamond' : '';
?>
<!-- Begin loop-template -->
<article <?php post_class( $cpt_class ); ?> id="post-<?php the_ID(); ?>">
... your stuff here ...
</article>
So only if the post-title is ‘diamond’, the article has the css class ‘post-is-diamond’.
Related Posts:
- Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?
- How do I change the author of a custom post type?
- Custom Post Type Plugin: Where Do I Put The Template?
- Creating a Custom Post Type as a Plugin? Why?
- How to add a button to custom post type’s posts-page
- Creating a custom public user page
- Is flush_rewrite_rules necessary when creating a custom post type? Why?
- Remove Slug from Custom Post Type results in 404
- Unable to filter on field on edit.php page
- Insert slider (Custom Post Type) into pages
- How do I create a custom post type for a training CMS in WordPress?
- WP Query group/order by category name
- Save or update data when custom post published
- Custom Taxonomy and tax_query Issue?
- Using posts and postmeta table to store custom Address Book Plugin data
- template_redirect not working, apparently for no reason
- Custom role capabilities to administrator not taking effect (no plugin)
- How to add multiple featured image in meta box in post editor?
- Hierarchical or Non-hierarchical Custom Post Type in Real World Example
- How to append element after thumbnail
- Adding Meta Boxes while Registering a Post Type in a Class
- handling csv data with a custom post type
- Custom Post Type | Fatal Error on register_post_type()
- Custom Post Type rewrite
- Admin notice not displaying
- Detect where custom post type is declared
- Insert Multiple Post with Same Publish Button
- get_object_taxonomies() returns empty array for custom post type
- custom post type not showing in menu
- Adding a custom post type taxonomy template in plugin
- Plugin: register custom post types, child ready and performance best practices
- How to add a custom taxonomy to show up in a custom post type menu?
- Add custom ID to CPT posts only create not update
- Add custom post type as submenu [closed]
- Getting meta in editor plugin, and event triggering issue
- Unable to get Custom Plugin Options data
- What is the best practice for displaying my plugin content in themes?
- How to use TinyMCE Editor for one of my custom post meta field?
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Problems wp_insert_post and save_posts filter
- wordpress remove views from action links in a custom post
- Send a conditional email notification when a custom field value changes in Post Type
- how to set a WP Plugin’s url
- Getting 400 Bad Request on AJAX Call
- detect your custom post type in WordPress
- Option page’s form doesn’t work
- How can I include active content in a custom post type?
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- Add to ‘action’ within post.php to allow more actions when editing a Custom Post Type in a plugin
- ajax response not recieving
- Add post type pages with plugin
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- CPT to installable Plugin
- Most viewed post of custom post type
- filter the_content, custom post type, and wp_query
- Fill custom fields when saving custom post types
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Custom post type page with parameter
- Change Dropdown jQuery to show/hide but with default place holder that shows all
- Custom post category name showing empty
- How to show the post which checkbox is not selected
- Is it possible to get the specific content on the search page?
- Get next and prev item from custom WP_Query and Custom Post Type
- Replace Content of Sidebar on Custom Post Type
- How add Filter by Tags and by categories to custom post type in Gutenberg block
- Error 404 change permalink term custom term taxonomy
- Show a custom post title in another custom post type in Meta box
- Register custom_post_type from static function
- I have a random letter appearing before my content. Where to start looking for the cause?
- Apply a custom Template to a Custom Post Type from within a plugin
- WP_List_Table Inside Metabox Not Working on Clicking Search Button
- Correct way to register custom post type from external php file?
- How to Use A Custom Post Type as Taxonomy for Another Custom Post Type
- Add an array as post content dynamically
- Which File Populating CPTs in Slug URL
- Front End users account with lots of user Roles (not Woocommerce)
- How save custom meta type posts multicheck grouped by taxonomy (with CMB2) [closed]
- Not Able to List CPT Based on Taxonomy Term
- How to reset HTML filter input fields on CPT list page?
- Foreach in get_post_types to apply a different filter per post type
- In WordPress do I create tables for my plugin or do I create custom post types for a Student and Classes Registration system?
- Simple renaming my custom post type set with a plugin doesn’t work?
- Display custom post type archive on page.php template
- get_post_types doesn’t work in plugin
- Show Templates in Custom Post Type Editor
- Associate custom categories to different user IDs
- Render custom taxonomy query as single template
- How to avoid hardcoded text in a custom page template?
- How to use get_sidebar in plugin folder?
- Resources to learn OOP for WordPress plugins, custom post types, etc
- How to create an upload page (front side)
- How to dynamically register custom post type
- Custom post type template not loading from plugin
- I am having a problem with fetching product data in the Gutenberg block editor
- Add block templates (html) via plugin for custom post type
- how can i call archive-{post type}.php template from my custom plugins to my theams?
- REST API callback function is not called
- Display box in sidebar of custom post type
- Add taxonomy or category slug to custom post types URL