There is various approach you could take. All you need to do essentially is to get the author’s role and put it in a statement of sort.
For example, let’s get the author role first by:
// inside the loop
$author_role = get_the_author_meta('roles', $post->post_author);
Then just use do a if statement like:
if ($author_role == 'contributor') {
echo '<img src="https://wordpress.stackexchange.com/questions/177751/contributor-ranked-user.png" />';
} else if ($author_role == 'author') {
// ...
Or to optimise it a bit, you could just target the filename if you can add the name of the role within it, something like this maybe:
echo '<img src="'. $author_role .'-ranked-user.png" />';
Related Posts:
- Update post counts (published, draft, unattached) in admin interface
- How to Display a List of Users Who Have Made at Least 1 Post?
- Find out who deleted a page or post?
- WordPress: How to get the current logged in author page URL?
- disable password protected page for logged users
- Force “Submit to review” when a post is updated
- Overview with latest edited posts and pages
- Navigation link to specific user page
- Get how many days since last post of the current user
- Hide comments awaiting moderation from user who submitted the comments
- Query All users that has post
- Limit number of posts a user can make per minute?
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- wp_insert_post let users post to without login…broke
- Get user’s most published categories
- Allow anonymous users to post to my site for moderation
- disable column on post and user list
- how to find user ids of all commenters in a post
- How to list users and their post amount?
- Is there any way to allow users to access content before it’s published?
- UberMenu list current user’s posts as menu items
- Create post for every user?
- count the total number of comments the user has received for his published posts
- Restrict users post for himself
- How to allow logged in users to post anonymously
- Allow public to post on blog
- current post with current author
- How to verify wp user password by sql query in wp? [closed]
- How can i delay reading posing in 3days for not logined user?
- Encountering “Wrong nonce. Action prohibitied.” when trying to alter User Role and unable to Post via WP Admin
- Users problem (multi-author plus multisite)
- How do I manage my users post before publish?
- How do I retrieve a users’ last 5 posts?
- Gather posts into a cart/lightbox and share with another user
- Assign published posts to another user automatically
- Add field to user meta table in database when link is clicked
- Hide comments and posts posted by other user
- Automatically create a default set of posts for each new registered user
- Summary of Posts by an User
- Display a list of users who have viewed the post you are viewing
- Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
- Echo Text If User Is Logged in But NOT the Author of post
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- Show number of posts by logged in user
- Retrieve data from post meta meta_key having ‘_product_fq_image’ while having author_id and post type is PRODUCT
- Cannot select certain authors for posts after import
- How to limit post (Exception pages) for current user in each role in front end?
- How can get the last post date of the user?
- Is there a way to save different data when USER interacts with the same POST?
- How to display particular categorie’s post which associated to specific user?
- WordPress Delete Users from backend doesn’t work
- Allow users to post their videos to my wordpress website?
- Compare date of user’s last posts
- Add new post only in assigned category
- WordPress each user has each content for a page,how to do that?
- Count how many posts a user has viewed
- Allow users to create their own page/s
- Get current user array with post string
- My posts section for logged in user
- Show Custom Post From Logged In Author
- Delete old post with new post
- How to handle dates, trying to calculate time since a post
- each user having category with their name and can add sub categories post in that category
- The post order is different for logged-in and non-logged-in users? [closed]
- User submitted post
- Automatically select category based on user role
- Undefined Function Fatal Error with Shortcode [closed]
- How to allow Contributors to edit their own posts, whilst still needing to be reviewed by an admin?
- Allow users to edit post without logging in
- Query Posts by Custom Field
- What are the benefits of setting a “featured image” for a WP blog post?
- How include css class based on post ( in loop ) slug?
- How to have one page show posts reverse-chronologically, but the others chronologically?
- When moving a WordPress installation to a new server, why do I have to update each post before content shows?
- wp_insert_post not working fine
- Post title is not showing
- Change Author Name to Sitename on Frontend
- Inserting Media to WordPress Posts
- Problem with trying to display subheader in posts
- Using the loop to set locations for all posts on a single google map
- Change content off every sixth element
- WordPress, custom post type and posts query help!
- Custom post type and taxonomy page templates
- Get post slug and match with menu item slug to change css
- Can’t find webpage on All Pages or All Post menus
- Display Specific Categories posts on the home page
- Integrate video and iframe in a post type gallery
- Modify loop to include all post statuses not just ‘published’
- How to convert return type of ‘get_posts()’ same as ‘wp_get_recent_posts()’?
- Filter question list on substring of metavalue
- Embedding Facebook in blog post not working
- How to list all names and descriptions of a custom taxonomy
- Post List Widget with custom posts and editing the Read More Link
- Loop not allowing infinite scroll after post per page limit
- Customise the appearance of 4 specific post ID’s within the loop?
- Attaching global meta to custom fields
- Is there a maximum amount of pages for a multi-page post?
- Only show posts belonging to multiple cateogries at same time
- Wrap posts from a category in HTML
- How can I use wp_after_insert_post with $current_screen?