• Resolved humbertorobles

    (@humbertorobles)


    Hi there,
    The Generatepress header structure has this function:

    function generate_construct_header_widget() {
    		if ( is_active_sidebar( 'header' ) ) :
    			?>
    			<div class="header-widget">
    				<?php dynamic_sidebar( 'header' ); ?>
    			</div>
    			<?php
    		endif;
    	}

    I would like to add a class to the dynamic sidebar in order to get something like this: <div class="header-widget align-self-end">. Another posibility would be to add a wrapper between this div and the widget sidebar.
    Has Generatepress any filter to add this class? Another way to solve it?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @humbertorobles

    There’s no filter to add a class to the header-widget. You would need to use a Child theme and alter header.php to do as such.

    Another alternative is through adding a script. For instance:

    <script>
    
    var headers = document.getElementsByClassName("header-widget");
    	
    for (var i = 0; i < headers.length; i++) {
    headers[i].classList.add("align-self-end");
    }
    
    </script>

    If you have GP Premium, you could use the Hook Element feature to easily add this script.

    Hope this clarifies.

    Thread Starter humbertorobles

    (@humbertorobles)

    Hi,
    I prefer using Javascript than modifies header.php

    Everything clear, much appreciated.

    You’re welcome @humbertorobles!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘generate_construct_header_widget()’ is closed to new replies.