skip to Main Content

Automatically Add Content Under All Pages With Overlay Header Enabled

If you are working on a site where you are using the overlay header for a specific design on multiple pages rather than using the Visual Composer to add the content under it (if it can be gathered dynamically) you can instead use a child theme function to automatically add a row beneath the overlay header which you can than apply CSS to...etc. This is a basic example but the possibilities are limitless!

// Add custom full-screen row for all overlay header pages
add_action( 'wpex_hook_header_after', function() {

	// Not needed if overlay header is disabled
	if ( ! wpex_has_overlay_header() ) {
		return;
	}

	// Your custom overlay header under the header output below
	// This is a basic example but you could do anything..
	// For example you could grab the page featured image and add it as a background to this row
	// via inline style
	// Or you could even return VC content via a templatera template see this article:
	// https://total.wpexplorer.com/docs/snippets/add-custom-content-multiple-pages-via-visual-composer/
	// ....etc ?>

	<div class="my-custom-overlay-header-under-content wpex-clr">
		<h1></h1>
		
			<p></p>
		
	</div>

<?php } );
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