I think you can add an class to the [post_class()][1]
function via Filter; the name, the string can you use form different values: tags or post title?
The follow example use the title of post and add this to the classes of post; if you use the post_class()
function on post tag in markup. Also you can use other values for design this.
function fb_title_post_class( $classes ) {
global $post;
$classes[] = sanitize_title_with_dashes( get_the_title( $post->ID ) );
return $classes;
}
add_filter( 'post_class', 'fb_title_post_class' );
Related Posts:
- Custom post type loops with different page templates
- How do you output custom code between posts in the loop?
- How would I create a shortcode to display a custom post within a page or regular post?
- Best way to style first post differently?
- Shortcode not working with post counter
- Loop increase number
- Get post format
- posts within custom post type all share the same content in the front-end
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- Pagination not working in custom post type. Help
- subtracting the current post form then whole loop, which is generating all CPT titles
- Where paramaters of a custom function are coming from inside the loop?
- Display all posts in a custom post type, grouped by a custom taxonomy
- Displaying Custom Post Types In “At A Glance” Meta Box
- Display a query with multiple post types and same relationship on a single page
- how to group custom post types
- echo value from ‘select’ field type into page template using cmb2?
- Exclude add_filter from the admin
- WordPress 3.1 – How does one add sticky post capabilities to post types
- Retrieving 3 latest post from each of 5 different custom post types
- Posts to expire (deleted) after a date
- White screen error for a custom theme
- Newer/Older posts links display same posts on every page
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Exclude Custom Post Type & Pages From Auto-Tag Function
- Fix custom query pagination without changing site-wide posts-per-page settings
- Randomly placed sticky custom posts complemented by blog posts
- Displaying custom posts only if custom meta box’s date is not expired
- Integrating Orbit slider into wordpress through custom post type
- How to change the admin menu “Pages” to something else
- Apply post formats to a specific post type only?
- How to get all posts except for one post from a certain custom post type?
- Create a random unique 6 digit number as custom field for custom post type
- Loading all files within a directory
- Filter by custom taxonomy slug on a custom post type
- Change or update WordPress loop based on dropdown selection
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- How to display all posts from standard posts to custom post types in a loop with pagination?
- Return the latest post from a custom Taxonomy and Post Type
- Redirect 404 page with ID in slug to associated page with same ID in slug
- Display featured image from one CPT within another CPT query
- Anon function and add_meta_box
- Full Custom Post Type List Organised by two Taxonomies
- Get custom post type’s fields in a while loop as variables
- Allow users to create posts without logging in?
- pagination not working for category.php (custom post types in categories)
- Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
- Custom Post Type single.php template only shows the latest post
- Tag page only display 10 posts
- custom post type metaboxes not saving
- get_post_type is always post
- Control content before and after custom post type loop
- Showing custom post type categories in the menu
- How to use a variable as a function name?
- Custom Post Type not showing in main loop
- My custom taxonomy is only displaying 1 of 3 terms
- Custom Ratings for Theme, Proper way to Refactor Code and Clean up Template File
- Custom Post type content within a slider
- displaying content of custom post type
- Using Wp_Query, Json to add Highcharts series data
- Display the current post in browser as the first post in a loop (for a slideshow)
- Custom Sidebar in Editor (not Widget) for Custom Post Type in Genesis
- Loop Post Types with Name and Links
- Display all images from specific CPT
- Let users upload image(s) to the post from front end
- Custom loop to query posts with no featured image and/or no post editor content
- Have custom post type Visibility be private by default, and have radio button also set to “Private”
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- Custom Post type showing up in loop, regular posts are not showing up
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Sorting custom post types in edit.php : Post disappear
- Function to allow single post template based on custom taxonomy?
- Last post in loop – custom post types
- Display category name of custom posts only once in the loop
- What is the best way to set the post category (Custom Post Type) automatically based on the one of the tags assigned to the post?
- Custom Form / Search with Custom Post Type Data
- Make bootstrap 5.0 carousel dynamic using ACF and CPT UI [closed]
- Pagination Not Working When Used With WP_Query() `offset` Property
- Custom attachment function not working in v5.4.2?
- Excluded Custom Taxonomy Term Posts Displaying in loop
- CPT tags not showing when editing post
- Some posts not displaying by taxonomy term
- Persist meta box choices throughout all posts of same post type
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- Custom Function to redirect singular post if specific meta field is empty
- How to return custom posts in loop?
- custom post type loop
- Loop with Custom Post Type and Taxonomies
- How can i call a custom method on submission of a custom plugin post type?
- WordPress Custom Post Type and sort by Tags
- After rewriting post type’s URL, the number of queries has increased dramatically
- Rich Custom Field for Custom Post type not saving
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Sorting custom post types by taxonomy (So close)
- Pagination not working with custom loop
- Looping taxonomy in taxonomy?
- Custom Post Type Loop breaking php
- Styling first post using Advanced Custom Fields
- Passing postid of Testimonial Custom Post in Shortcode Parameter
- Is it possible to use a post name in a custom post slug?