<?php
$typeface = $page->typeface();
if($typeface == '') {
} else {
echo '<li><span>Typeface: </span>'.$typeface.'</li>';
}
?>
I initially tried the PHP code below but it would still output the HTML:
<li><span>Typeface: </span></li> even if the string was empty.
<?php $typeface = $page->typeface();
if (!empty($typeface)): ?>
<li><span>Typeface: </span><?php echo $typeface ?></li>
<?php endif; ?>
So my question is, how can I write the code at the very top in a shorter way?
EDIT: (removing new lines)