I am trying to use an IF statement if variable $credit is not empty. However, I get a parse error. Could anyone please help with my syntax?
$credit = get_field('fl_credit', $image['id']);
return '<div class="kalim"><img title="' .
esc_attr( sprintf( the_title_attribute( 'echo=0' ) ) ) .
'" alt="' . esc_attr( sprintf( the_title_attribute( 'echo=0' ) ) ) .
'" src="' . $image['url'] . '" /><div class="kalca">' .
$image['caption'] . '</div>' .
if($credit) {'<div class="kalcr">Credit:' . $credit . '</div></div>' };
Aucun commentaire:
Enregistrer un commentaire