badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Header Sidebar

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25192
    Jason
    Participant

    Hi, I am trying to create a sidebar in the header. I’m using the following code in my functions.php file:

    <?php
    /**
    * Register Widget Area.
    *
    */
    function header_widgets_init() {

    register_sidebar( array(
    ‘name’ => ‘Header Sidebar’,
    ‘id’ => ‘header_sidebar’,
    ‘before_widget’ => ‘<div>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2 class=”rounded”>’,
    ‘after_title’ => ‘</h2>’,
    ) );
    }
    add_action( ‘widgets_init’, ‘header_widgets_init’ );
    ?>

    However when I insert the following code into my header.php file, depending on where I place it, the side bar either goes to the very top of the page (above the title (and contact bar) or below the page title (right before the page content):

    <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘header_sidebar’) ) :

    endif; ?>

    Ideally, I’d like to have it located right below the Logo/navigation menu, but above the page title. Is this possible?

    Thanks

    #25217

    Hi Jason,

    Yes you have done it correct but the placement is in wrong place. you need to customize the code inside theme folder-> inc -> structure -> header-extension.php and find the right location and then customize the code. If you do you direct changes in the code then while updating to our new version your customized code will be lost. So you need to create a child theme to be safe from data loss.

    Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.