# Print only if there is something

Source: https://uglydev.com/docs/how-do-i-print-values/print-only-if-there-is-something/
Updated: 20 November 2026

**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
<?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
<?php if ( $row->has( 'subtitle' ) ) : ?>
	<h2><?php $row->show( 'subtitle' ); ?></h2>
<?php endif; ?>
```

> **Switches and zeros:** A switch set to *no* or a number `0` is also false in an `if`, but it **was** saved. When the difference matters, compare it: `if ( true === ugly_get( 'show_banner' ) )`.
