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
- Customize rel=canonical tag for single blog post
- How to I retrieve the ID from the Posts page?
- How to save meta checkbox WordPress
- disable Tab post on nav-menus page (Admin)
- Adding bootstrap classes to video shortcodes
- How to calculate the average of a post meta value(Numeric) of a specific author
- Every second post different class in blog view
- Format latest/newest post differently
- is_page Funtion for Posts ?
- Is there any way to tell when wp_postmeta has been updated?
- Post type no single page
- Get post meta retrieving wrong value
- Adding a user’s ID behind the tag ref link address
- wpColorPicker – problem with implementation to post meta
- The_excerpt() doesn’t parse – how to change that?
- How to only publish posts with image in it
- Isn’t the way posts are displayed very unefficient?
- Add custom text automatically on each post
- How to check in functions.php if there is data in a WP_Query?
- Change post author without using wp_update_post()
- if in category but only with post meta
- restrict incrementation of post vies count when refreshing the page
- Defined function isn’t showed on page
- wp_query with ajax
- Update post meta within save_post action
- WordPress 302 Redirect to Random Product/Post/Page
- Display post number by category
- Updating post meta for checkbox
- Saving Post Data in Another Database
- Getting Whitescreen when publishing a post [closed]
- Using system date format
- Get post by tag
- Add code to a specific post’s content
- Related Posts function not working
- Custom permalink for each post
- the_content() Not Grabbing All Content
- How can I tell if a post has been published at least once?
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- Is there a way getting post fields using `transition_post_status`
- Automatic blog page with custom design [closed]
- Is it advisable to use $post->comment_count instead of get_comments_number( $post_id )
- Add multiple meta keys to a post at once
- Show number of posts by logged in user
- How does WP decide how to display a page
- Related Posts: Changing Function For Posts Per Page
- When sending a newsletter -not with wordpress- the server has 100% cpu [closed]
- Retrieve data from post meta meta_key having ‘_product_fq_image’ while having author_id and post type is PRODUCT
- Query function not executed between element [closed]
- Insert data from custom created PHP page into wp_postmeta table
- Optimize CPT-function with a loop
- Adding a meta box to determine the sidebar [closed]
- The loop starting at a certain ID
- Simple Custom Metabox Not Saving
- Same post appears in related Posts?
- Internal linking to posts permalink fail because of spaces and stripe at postname
- Get post category as a separate string and url
- 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
- Help on conditional statement to accompany wp_insert_post function please?
- How to implement a WordPress comments function?
- How to add content above footer in posts from specific category
- Set Default Post as Parent Child (Nested) Relation
- I need to create “View Profile” and “Edit Profile” links by incorporating the Post Title/ID, but can’t seem to manage it
- Featured Images most often doesnt appear
- Post meta not working
- how to show comments only author which send own posts in wordpress
- get category in list of posts // shortcode for custom related posts
- shortcode // get posts by ids
- How to bulk Update URLs to new values?
- Select another post in a post meta like a parent page is selected while editing a page
- 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
- Alt text attributes not showing over portfolio images
- Find most used words in post titles
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- $post->post_content empty while all other properties are correct
- Function is printing twice – any suggestions?
- How to add a custom class attribute into code wrapper? [duplicate]
- Private post caught in endless redirect loop
- How to retrieve all meta data directly from the $post object? Such as $post->related_topics?
- What is proper filter or hook action to add data to the $post object?
- Remove pagination if search returns empty
- Remove HTML tags from all posts
- Set a post expiration and delete a post when expirate
- Blogposting Schema & Structured Data without plugin
- Automatically select template based on query string for New Posts
- Display Updated Date Instead of Published Date
- How do you update post date (year only) in a separate custom field?
- I want to change the WordPress comments file
- Add postmeta to all blog posts
- Replace Tag Keyword With Link Within Post Content
- Excluding tag Link from html tags in Post content