You can update the post classes depending on user role to include an additional selector which add your custom styling i.e
function add_contributor_class_to_single_post( $classes ) {
if ( is_single() ) {
$post_id = get_queried_object_id();
$author_ID = get_post_field( 'post_author', $post_id );
$author_data = get_userdata( $author_ID );
if (in_array( 'contributor', $author_data->roles)) {
// add post class
array_push( $classes, 'user-contributor' );
}
}
return $classes;
}
add_filter( 'post_class', 'add_contributor_class_to_single_post' );
Then update your css to:
.type-post.user-contributor { border: 10px solid #fff }
.type-post { border: 20px solid #000 }
Related Posts:
- Enable specific CSS Code for Visitors and specific Roles
- Change color of audio player depending on user role
- How do I apply/target CSS to a specific user role or roles?
- How to insert the current user’s role into the body class in the admin backend
- check the first login for specific roles
- How to get these two divs side-by-side?
- How to change the color of an svg element?
- How to implement max-font-size?
- @Media min-width & max-width
- How do I center this form in css?
- Float a div above page content
- What does an asterisk (*) do in a CSS selector?
- height style property doesn’t work in div elements
- How can I horizontally align my divs?
- background-size: cover not working?
- combined multiple classes into one css rule
- CSS – display: none; not working
- Is there an opposite to display:none?
- Rainbow gradient on text in CSS
- CSS3 opacity gradient?
- use multiple css filters at the same time?
- font-weight is not working properly?
- What would be the best method to code heading/title for ul or ol, Like we have caption in table?
- How can I make my header image properly responsive?
- CSS fixed width in a span
- Adding border to CSS triangle [duplicate]
- What is the correct way to enqueue multiple CSS files?
- Remove wp_add_inline_style
- How to implement different color schemes in your themes
- @font-face doesn’t work
- WordPress Register Style Called Incorrectly
- How to target first img in every wordpress post with CSS [closed]
- How to change Parent Themes in Child Theme CSS
- Duplicate and alter sidebar for Twenty Eleven
- Set Image width=’x%’ (percentage width not pixel width) when inserted via the media manager?
- How to dequeue styles coming from plugins?
- How do I style WordPress pages differently based on the tag used?
- How/where to add additional stylesheet to WP
- How the Css File is Linked without calling it in header.php?
- Use stylesheet from a different location
- Show enqueued CSS and Script in custom header
- How to insert html/css/javascript code to wordpress plugin
- Importing changes to Child Theme
- Save changes in CSS after removing Menu from specific page
- Move the position of menu item [closed]
- Title has word broken when viewed in mobile [closed]
- Change background color of subpages
- How to fix this error? [closed]
- Advanced: understanding wp_add_inline_style function
- WordPress code editor messed up my code!
- How to change “““ to “““?
- How to remove parent style.css from the header
- Placing background image over section divider
- Remove CSS & JS from
- enqueing Javascript and CSS
- Acessing HTML element with no specific tag on it [closed]
- Aligning line made with CSS [closed]
- Earlier stylesheet not overriding later one
- Order of WP page load (including widgets, php, plugins, media, templates, and CSS) [duplicate]
- CSS is not loaded on mobile devices
- Fixed height of the_content()
- How can I add inline CSS for each image?
- Creating a second menu on Twenty Eleven aligned right from the first
- Help with a little CSS logo/header modification?
- I have html form and need to make it work in text editor on template. Only problem is it has .sccs styling file
- underscores theme – sass folder structure vs smacss
- Inclution place of CSS file
- Unused CSS in WordPress Plugins
- I have text on a banner on my wordpress site and I am unable to get rid of it? Would appreciate any help or advice :-)
- Img load while refreshing
- Twenty Fourteen: Unsticky header after making header bigger
- How to display javascript banner in website header?
- Loading css files conditionally useful?
- Is there any way to turn off a particular scrolling behaviour?
- Sidebar at bottom however I have completely replaced theme folder back to original code
- Site not 100% responsive
- Dropdown menu’s fighting with each other [closed]
- Customizer: CSS changes not persistent
- Scale An Image Thumbnail
- Which hook to use to add notification message at beginning of my
- single.php doesn’t getting style
- Converting Static HTML pages to WordPress
- Background tiles not working in iPad2 but ok everywhere else
- How to make widgetized footer styles be inherited from body?
- custom css in admin panel by user id
- How to customize a theme’s navigation menu with css
- Site layout problems when logged in due to admin bar
- Add “sub-nav” class to a sub menu parent item
- Current Post/Page Ancestor, CSS
- [class*=”content”]:before css styles in TwentyThirteen [closed]
- How to change the CSS in one file?
- Custom css code in wordpress [closed]
- Using Easy Google Fonts correctly and Droid Sans on Max OS X [closed]
- remove white overlay [closed]
- How enqueue CSS out of theme folder?
- Styling not refreshing for old visitors on WordPress
- How to add CSS to WordPress
- How to add arbitrary custom CSS to a WordPress Block Theme using Site Editor?
- Wrap post titles containing slashes on narrow viewports
- Import css file from node_modules using @wordpress/scripts