# A site-wide announcement bar

> A bar at the top of every page, switched on and off from the admin.

Source: https://uglydev.com/recipes/a-site-wide-announcement-bar/
Updated: 20 November 2026

![The announcement bar above the header](https://uglydev.com/wp-content/uploads/2026/11/shot-a-site-wide-announcement-bar-1-scaled.webp)

*The announcement bar above the header.*

**Fields.** On `Site options`: `announcement` (Group): `show` (Yes / No), `text` (Text), `link` (Link).

```php
<?php
$announcement = ugly_get( 'announcement', 'option' );

if ( $announcement && $announcement->get( 'show' ) ) :
	$link = $announcement->get( 'link' );
	?>
	<div class="announcement">
		<?php $announcement->show( 'text' ); ?>
		<?php if ( $link ) : ?>
			<a href="<?php echo esc_url( $link['url'] ); ?>"><?php echo esc_html( $link['title'] ); ?></a>
		<?php endif; ?>
	</div>
<?php endif; ?>
```

An editor turns the bar on and off from one screen, without touching the theme.
