Mettere else se il campo è vuoto
Questo codice mette a video i commenti recenti del mio blog, vorrei mettere un else che se non ci sono commenti, scrive "Non ci sono commenti".
Codice PHP:
if ( $avatar ) {
$format .= '{avatar} ';
}
if ( $post_link ) {
//* translators: comments widget: 1: comment author, 2: post link */
$format .= sprintf( _x( '%1$s on %2$s', 'recent comment', 'better-recent-comments' ), '{author}', '{post}' );
} else {
$format .= '{author}';
}
if ( $comment ) {
$format .= ': “{comment}”';
}
if ( $date ) {
$format .= ' {date}';
}
return $format;
}