You can do something like this:
<a href="https://wordpress.stackexchange.com/questions/80014/<?php echo get_post_type( $post->ID ); ?>" class="<?php echo str_replace(' ', '-', get_post_type( $post->ID )); ?>">
<?php $post_type = get_post_type_object( get_post_type($post) ); echo $post_type->label ; ?>
</a>
and in your CSS part you can do something like:
.pretty-little-liars
{
background color: khaki;
}
.once-upon-a-time
{
background color: blue;
}
Related Posts:
- Style custom columns in admin panels (especially to adjust column cell widths)
- get post type plural
- How to add a CSS class to every image in a Custom Post Type
- CSS for Custom Post Types
- Is it possible to insert text into an html tag using functions.php?
- How do you use JavaScript to detect the homepage
- Custom Post Type and taxonomies’s labels localization not working
- How can I use a different default admin menu icon for custom post type?
- Add the current menu item CSS class to a custom page type archive in WordPress menu
- different template for first and second level custom post page
- Change post featured image on hover
- Custom post type and body_class: Remove “blog” class
- Is possible add class for last post of Custom Post Type?
- Customize my custom taxonomy table in Admin panel
- How to Create Columns with WordPress and CPTUI display page ?
- Custom Post Types — $args vs. labels array
- Add custom CSS class to custom post type
- Change “empty trash” button text?
- Displaying custom post types as a gallery
- Trying to add a class to post links
- One Site. One Theme. Multiple Stylesheets without plugins?
- Posts are not rendering perfectly [closed]
- Questions regarding add_meta_box()
- Multiple Stylesheets For Post and post type?
- Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed
- DIVI Theme customizer changes not applied on existing pages and designs are not shown on the front
- Custom post type not pulling CSS
- Is it possible to link an external stylesheet, exclusively within a specific single post template?
- Displaying image instead of post label in wordpress
- Changing menu label to post name for custom post type
- Change Background Color For CPT Template
- Can’t open Custom Post Types Link in navigation
- Multiple search template with separate stylesheets
- Multiple Block Quotes without using HTML
- How to insert post into a page?
- Woocommerce product page is not showing custom css [closed]
- WordPress custom post type odd and even styling [duplicate]
- How do I target a links only in a custom post type and only in the p tag?
- Add a background image into a post [closed]
- how to display custom taxonomies in front page
- Adding custom post type archives to a WordPress menu
- Get Posts in a Custom Post Type category
- Custom field values deleted when trashing custom post type
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- Custom Post Type Archives by Date with Custom Permalink
- Custom post type save_post action not firing
- Limit the post for differents custom post type in the same wp_query
- Custom Post Type archive as front page
- How to auto send email when publishing a custom post type?
- Dynamic page.php template for custom post types
- How to get Custom Post ID by adding filter to child theme’s function
- Parent / Child formatting in a list of post of a custom post type
- Dynamically Create Custom Post Type According to Relationship Another Custom Post Type
- Fake mark a menu item as current_page_item/active in WordPress
- Custom Posts Types as Custom Fields
- Hierarchical Custom Post Types in Array
- Show a Category X’s custom post type on Category X archive page?
- How do I display content to users who are not logged in instead of 404 on Private custom posts?
- custom post type and hidden url : what is the cleanest way to build CPT with custom page template?
- Structure of data : CPT + terms
- Disable saving posts as draft (make all posts mandatory regardless of the post status)
- page menu entry for custom post type
- Exclude objects from WordPress API based from ACF field using rest_prepare_{$post_type}
- How to remove post listing page for a custom post type
- How to include term custom meta into the custom taxonomy term permalink structure
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Custom Taxonomy not being saved on custom posttype
- Different Ways to Query Custom Post Types?
- Showing only one category on portfolio page BUT filtering remaining categories with Isotope
- How to get only child terms from a custom taxonomy of current post type?
- Custom post type permalink sends to 404.php
- Running a wordpress action when a custom post type term (taxonomy category) is changed
- Custom post types with categories in template
- How to create a one to many relationship in two different custom post types
- Creating custom post type posts and associating them with a post from another custom post type
- Jetpack Infinite Scroll won’t fire [closed]
- Category Name with Custom Post Type
- CMB select with data from CPT
- All blog posts are not showing up
- How do i display post from a taxonomy term?
- Disable trash for post type
- Multiple permalinks for a single post with multiple taxonomies
- i need to have a tab with gategory post
- get_posts() returns empty on custom post type /wp-admin/edit.php
- Custom post type specific item design
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- WP REST API Custom endpoint don’t work in my plugin
- Limit posts per page depending on the size of a div?
- Setting up a page to house certain types of posts
- WordPress loop add heading before first of type
- Can I override the permalink/slug on creation
- Rewrite Endpoint Url without ? before endpoint
- Displaying taxonomies with manage_{custom-post-type}_posts_custom_column
- How can I list custom post by custom category?
- Advanced Custom Fields: single-books.php works, books.php does not
- Custom Post-type not returning the right child_of
- Create custom post order (with custom post type meta)
- Single page for Custom Post Type not found
- WPNavi pagination links not working on custom pages
- Rewrite Rule for custom post type link with or without taxonomy terms