In the Velux theme functions.php there is this:

if ( is_front_page() && is_active_sidebar( 'hero' ) ) 

Which apparently means the Hero widget only functions on the home page. I used that widget to add custom HTML that needs to be in the header on all pages.

I tried the following mod to functions.php and cleared the cache, but cannot see the custom HTML on other site pages. Site is not yet public.

if ( is_page() && is_active_sidebar( 'hero' ) )
  • remove is_page() then hard refersh browser( ctrl+f5 ) and check Aug 18, 2017 at 17:13
  • what is the code inside the if block?
    – inarilo
    Aug 18, 2017 at 19:00

2 Answers 2


is_active_sidebar() does not refer to a specific widget. It means if there is any widgets in your sidebar.

According to codex:

Any sidebar that contains widgets will return TRUE, whereas any sidebar that does not contain any widgets will return FALSE.

Also, is_page() only works when the query has been run. It doesn't work at any points before that, you might want to check that out too. However since you are using is_front_page() I assume the query has already been run.

  • in is_active_sidebar( ) required Sidebar name or id due to wordpress documentation. Aug 18, 2017 at 18:40
  • Yes. You should pass the sidebar's name.
    – Johansson
    Aug 18, 2017 at 18:42
  • The github solution was apparently an alternative method that bypassed is_page() and/or is_front_page()
    – Luke 5 Dev
    Aug 18, 2017 at 21:59

Here is the successful answer from a developer on GitHub. I put this in my functions.php.

 * Ensure the hero widget persists across all pages
 * @author GoDaddy
function godaddy_persistent_hero() {
if ( is_front_page() || ! is_active_sidebar( 'hero' ) ) {
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' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.