• Antonio

    (@antscribanogmailcom)


    Hello,
    what hook can I choose to add a widget area inside the “inside-top-bar” div?

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there,

    there isn’t a hook inside that <div>.
    To add one would require custom development. For some pointers heres the generate_top_bar function:

    https://github.com/tomusborne/generatepress/blob/b60b853630da6d9015722da903e53c8064148b0a/inc/structure/header.php#L342-L363

    You could create your own function using that as a base to include your hook.
    Then simply unhook the GP top bar and hook in your own function:

    add_action('wp', function(){
        remove_action( 'generate_before_header', 'generate_top_bar', 5 );
        add_action( 'generate_before_header', 'your_custom_top_bar_function_callback', 1 );    
    });
    Thread Starter Antonio

    (@antscribanogmailcom)

    Hi David,
    thank you for the answer.

    I also tried to copy a modified version of wp-content/themes/generatepress/inc/structure/header.php within the child theme folder (wp-content/themes/generatepress_child/inc/structure/header.php

    But WP is still using the inc/structure/header.php file of the parent theme. Is it a normal behavior?

    Thank you

    But WP is still using the inc/structure/header.php file of the parent theme. Is it a normal behavior?

    Yes.

    You would need to use the same method as per the Top Bar. ie. unhook the functions you want to replace, and hook in your own.

    Thread Starter Antonio

    (@antscribanogmailcom)

    Ok. I already tried your method and it works.
    Thank you
    Antonio

    Glad to be of help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding widget area in inside-top-bar div using hooks’ is closed to new replies.