skip to Main Content

Place An Advertisement Under Your Header/Menu

This sample snippet can be used to place extra code below your header such as an advertisement. While you could also do this via Theme Panel > Custom Actions, if your advertisement is javascript based it's best to use a child theme instead.

/**
 * Place An Advertisement Under Your Header.
 *
 * @link https://total.wpexplorer.com/docs/snippets/place-an-advertisement-under-your-headermenu/
 */
function add_banner_after_header() {
	echo '<div class="my-header-ad container">
		YOUR ADVERTISEMENT CODE HERE
	</div>';
}
add_action( 'wpex_hook_header_after', 'add_banner_after_header' );
All PHP snippets should be added via child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)
Back To Top