Add widget area to to header? - by fraser@yourwebsitepa.co.uk

This topic has 2 replies, 2 voices, and was last updated 6 years, 5 months ago ago by Olga Barlow

  • Avatar: fraser@yourwebsitepa.co.uk
    fraser@yourwebsitepa.co.uk
    Participant
    November 23, 2017 at 12:22

    Hi

    I would like to replace the search bar with a widget area (for a replacement search function)

    I can create the widget area in functions.php (with help from a blog)

    function wpb_widgets_init() {
    register_sidebar( array(
    ‘name’ => ‘Header Widget’,
    ‘id’ => ‘header-widget’,
    ‘before_widget’ => ‘<div class=”hw-widget”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2 class=”hw-title”>’,
    ‘after_title’ => ‘</h2>’,
    ) );

    }
    add_action( ‘widgets_init’, ‘wpb_widgets_init’ );

    and the following code in header.php should allow it to appear, but it is not showing.

    <?php

    if ( is_active_sidebar( ‘header-widget’ ) ) : ?>
    <div id=”header-widget-area” class=”hw-widget widget-area” role=”complementary”>
    <?php dynamic_sidebar( ‘header-widget’ ); ?>
    </div>

    <?php endif; ?>

    But it isnt showing, please can you help?

    f

    1 Answer
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    November 23, 2017 at 15:05

    Hello,

    We are unable to provide support for customizations under our Support Policy. Anyway if you want to replace existing search by any other you need to edit header structure file depending on header type that you use, in your case, it is xstore/headers/center.php. Do all the changes in child theme files.

    Regards

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.