Closed lukefivedev closed 7 years ago
Hi @lukefivedev
It looks like the Velux theme behaves a bit differently than the parent Primer theme. I did some testing, and can confirm that using the following code snippet should get things working (although it may require some style tweaks):
/**
* Ensure the hero widget persists across all pages
* @author GoDaddy
*/
function godaddy_persistent_hero() {
if ( is_front_page() || ! is_active_sidebar( 'hero' ) ) {
return;
}
add_action( 'primer_after_site_header_wrapper', 'primer_add_hero' );
add_action( 'primer_hero', 'custom_velux_hero', 20 );
}
add_action( 'wp', 'godaddy_persistent_hero' );
/**
* Render the hero.
* @return mixed Hero widget markup.
*/
function custom_velux_hero() {
dynamic_sidebar( 'hero' );
}
That worked on the first try! Thank you @EvanHerman so much.
Working on a Primer/Velux site where I would like my custom Hero text to show up in all headers. While researching, I came across your
godaddy_persistent_hero
that was posted here in response to another thread (issue#126). I cleared my WP cache but it does not appear to be working. Copying it below to save some time...