Skip to main content
Syntax was incorrect, missing a closing parenthesis on the first get_avatar in the if statement, and missing closing semicolon in the else statement.
Source Link

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 );
}

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)
}

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 );
}

get_avatar()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(echo get_avatar( get_the_author_meta( 'ID' ) == 0){
   // no img code
}else{
   echo get_avatar( get_the_author_meta( 'ID' ) , 80)
}

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(echo get_avatar( get_the_author_meta( 'ID' ) == 0){
// no img code
}else{
echo get_avatar( get_the_author_meta( 'ID' ) , 80)
}

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)
}
Source Link
Oreo
  • 19
  • 3

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(echo get_avatar( get_the_author_meta( 'ID' ) == 0){
// no img code
}else{
echo get_avatar( get_the_author_meta( 'ID' ) , 80)
}