get_avatar()
returns An img element for the user’s avatar or false on failure. The function does not output anything; you have to echo the return value.
so you can try something like that
if( get_avatar( get_the_author_meta( 'ID' ) ) == 0) {
// no img code
} else {
echo get_avatar( get_the_author_meta( 'ID' ) , 80 );
}
Related Posts:
- Human Time Diff, change mins to minutes
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Force the “Choose from the most used tags” meta box section to always be expanded
- Change all author links in Blog roll
- saving/reading custom field value does not work – no value gets POSTed
- Run function after post is updated
- How to change the case of all post titles to “Title Case”
- Function to execute when a post is moved to trash .
- How to allow hidden custom fields to be added from wp-admin/post.php?
- Fatal error: Call to undefined function post_exists()
- How to batch update post content with custom post meta value
- Change slug with custom field
- Code to auto expire posts after 30 days
- Keep a fluid max number of posts on site
- Edit meta data does’t work with custom sql
- Custom colors for post rows based on post meta value
- How to add an admin function only to posts, not pages?
- Custom wp_trim_words() function not trimming right
- How to Display Post View Count
- Remove double space after a period
- Adding Multiple Values to a Post Meta Key
- Delete Post From Front-End and attachment permanently
- Limit function to specific post category
- When paginating a Page with the tag, how can the 2nd and subsequent page styles be customised?
- Function to show random posts from a category
- Hiding posts in a list from specified categories
- PHP Notice error (when on 404 page)
- Checking is user author of number of posts?
- Checking if a post with certain meta value exists
- How to permanently delete a post meta entry?
- Create cron job without a plugin?
- Modify WP_Post before processing
- How to rename “Publish” metabox title in post screen
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- Uppercase first sentence in every post
- How can I sort posts by the date and a custom meta field?
- Get Meta Key Value While Saving Post
- Show the content that is after the excerpt using child theme
- How to allow users to post only in certain category and hide elements from edit page?
- Meta value does not save for scheduled posts
- How to compare two posts including their meta fields on a scalable base?
- Is it possible to paste a link without tags and make it directly a link in a post?
- Cannot retrieve a custom RSS field from posts
- Order posts alphabetically: how to set order=asc in mysql query?
- How to calculate the average of a post meta value(Numeric) of a specific author
- Post type no single page
- Adding a user’s ID behind the tag ref link address
- wpColorPicker – problem with implementation to post meta
- How to check in functions.php if there is data in a WP_Query?
- restrict incrementation of post vies count when refreshing the page
- Defined function isn’t showed on page
- WordPress 302 Redirect to Random Product/Post/Page
- Add code to a specific post’s content
- the_content() Not Grabbing All Content
- Query function not executed between element [closed]
- Optimize CPT-function with a loop
- The loop starting at a certain ID
- Simple Custom Metabox Not Saving
- Have h2 tag not show up if there are no blog posts
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- Making a wordpress page print friendly
- I need to create “View Profile” and “Edit Profile” links by incorporating the Post Title/ID, but can’t seem to manage it
- How to bulk Update URLs to new values?
- SQL DELETE multiple post_meta on single and multi-sites
- How to put the author of the post in the comments?
- Check if almost 10 year old – working code is up to date
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- Function is printing twice – any suggestions?
- How to add a custom class attribute into code wrapper? [duplicate]
- How to retrieve all meta data directly from the $post object? Such as $post->related_topics?
- Remove pagination if search returns empty
- Remove HTML tags from all posts
- Save All Post Permalink From A Specific Category into a .txt file
- How to Display Most View Post in the template file?
- WP_Query sort by meta_value_num or date
- Show post excerpt
- How do I apply a wordpress function to something with no ID inside an archive page?
- Show all posts from the tags without having to set all of them
- Show author bio box
- Display author bio box
- Creating Ordered Query using Meta_key
- Filter question list on substring of metavalue
- Add a meta to a post submited from a frontend form
- Call image from post on index page?
- How to get only current images of a post
- How do I get thumbnails?
- When Author add new post change default status to pending
- Adding custom fields to the Quick Edit screen – puzzled about the column concept
- fire action when post is being edited as well as saved?
- Getting rid of the blog page entirely
- List direct children of page
- Notify Author of the post if admin deletes his post and perform some function
- Ajax calls in wordpress
- How to display the date under the post title?
- NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)
- Show Next/Previous without Link
- How do I get a function to work in single.php
- Filters do not work when there are multiple (one works)
- Translation related post text to Arabic
- How to use shortcode to get the second to newest post?