Print values
Print only if there is something
You want: to draw a block of the page only if the editor wrote something, so there is no empty heading or button.
How
<?php if ( ugly_get( 'subtitle' ) ) : ?>
<h2><?php ugly_show( 'subtitle' ); ?></h2>
<?php endif; ?>ugly_get() gives null when the field does not exist for that page, and an empty value when it exists and is empty. Both are false in an if.
Inside a row
<?php if ( $row->has( 'subtitle' ) ) : ?>
<h2><?php $row->show( 'subtitle' ); ?></h2>
<?php endif; ?>Did this article answer your question?
Thank you. It helps us make the documentation better. Need more help?