Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example using wp_body_open hook to add a top banner
<?php // Ignore this first line when copying to your child theme's functions.php file.
add_action('wp_body_open', function() { ?>
<style>
.top-banner {
background-color: firebrick;
color: white;
display: grid;
font-size: 2rem;
height: 10vmin;
place-items: center;
width: 100vw;
}
</style>
<div class="top-banner">This is my cool Top Banner!</div>
<?php } );
/**
* You can add the PHP code snippet to your child theme's functions.php file
* or with third-party plugins such as My Custom Functions and Code Snippets.
* /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment