Support » Theme: Primer » Show Hero header widget on all pages

  • Resolved emergencyscotch

    (@emergencyscotch)


    As the title says, I’m looking for a way to show the Hero header widget on all pages, and not just the front page.

    Is there a simple way to do this, possibly using CSS?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I would also like this question answered. Currently, I am only able to load the menu on the homepage, but I need it to load on all pages.

    Please advise.

    Hi @emergencyscotch,

    There is no way to achieve this using CSS, but you should be able to do this with the built in functions/filters that we have in the theme.

    You’ll need to add the following bit of code into an mu-plugin. We have a tutorial setup on our Github page explaining how to achieve a custom mu-plugin found here:
    https://github.com/godaddy/wp-primer-theme/wiki/Customizing-Primer-with-hooks#how-to-create-a-must-use-plugin

    The following code you’ll want to add to your mu-plugin is as follows:

    /**
     * Rehook existing primer hero content
     *
     * @action init
     */
    function rehook_primer_hero_content() {
    
    	remove_action( 'primer_hero', 'primer_add_hero_content' );
    
    	/**
    	 * Display content in the hero element.
    	 *
    	 * @action primer_hero
    	 */
    	add_action( 'primer_hero', function() {
    
    		dynamic_sidebar( 'hero' );
    
    	} );
    
    }
    add_action( 'init', 'rehook_primer_hero_content' );

    That will render the hero widget on every page of your site, regardless of it being the home page or not.

    Let us know if that helps out.

    I am having the OPPOSITE problem. How do I REMOVE the Hero Texas from ALL pages??

    Thread Starter emergencyscotch

    (@emergencyscotch)

    I’m a bit late to respond but I followed your instructions and it worked like a charm.

    Thank you for your help!

    🙂 🙂 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show Hero header widget on all pages’ is closed to new replies.