• Resolved stellamaris5

    (@stellamaris5)


    I’ve added the PHP code to add the extra widget area between slider and navbar which I haven’t used so far as it doesn’t look great when I insert anything as it is always the full width.

    How can I make it so it is the same width and responsive like the slider and navbar so it doesn’t stick out?

    Secondly, how can I make it only on the front page rather than on all the pages, same like it works for the widget are after the FPs?

    The code I have is this:

    // Adds a widget area after the header//
    
    if (function_exists('register_sidebar')) {
     register_sidebar(array(
     'name' => 'Extra Header Widget Area',
     'id' => 'extra-widget-area',
     'description' => 'Extra widget area after the header',
     'before_widget' => '<div class="widget my-extra-widget">',
     'after_widget' => '</div>',
     'before_title' => '<h2>',
     'after_title' => '</h2>'
     ));
    }
    // Place the widget area after the header
    add_action ('__after_header', 'add_my_widget_area', 10);
    function add_my_widget_area() {
     if (function_exists('dynamic_sidebar')) {
     dynamic_sidebar('Extra Header Widget Area');
     }
    }
    
    // end of widget area after the header//
Viewing 2 replies - 1 through 2 (of 2 total)
  • instead of this:

    // Place the widget area after the header
    add_action ('__after_header', 'add_my_widget_area', 10);
    function add_my_widget_area() {
     if (function_exists('dynamic_sidebar')) {
     dynamic_sidebar('Extra Header Widget Area');
     }
    }

    this:

    // Place the widget area after the header
    add_action ('__after_header', 'add_my_widget_area', 10);
    function add_my_widget_area() {
     if ( ! tc__f('__is_home') ) return; /* just in home */
    
     if (function_exists('dynamic_sidebar')) {
      /*wrap in a container */
       echo '<div class="container before-home-slider">';
       dynamic_sidebar('Extra Header Widget Area');
       echo '</div>';
     }
    }

    Hope this helps.

    Thread Starter stellamaris5

    (@stellamaris5)

    Sweet, works great , thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Widget area between slider and navbar’ is closed to new replies.