• Resolved estudi33

    (@estudi33)


    Hi,
    I added a widget area in header using this snippet:

    // Adds a widget area.
    if (function_exists('register_sidebar')) {
     register_sidebar(array(
     'name' => 'Extra Header Widget Area',
     'id' => 'extra-widget-area',
     'description' => 'Extra widget area before 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 ('__before_header', 'add_my_widget_area', 10);
    function add_my_widget_area() {
     if (function_exists('dynamic_sidebar')) {
     dynamic_sidebar('Extra Header Widget Area');
     }
    }

    Now It has expanded the width of the page, and appears a horizontal scroll bar. The web is https://www.ppspark.com

    Thank you very much for your help!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try this:

    .my-extra-widget {
        max-width: 1170px;
        float: none;
        margin: 0 auto;
    }

    Thread Starter estudi33

    (@estudi33)

    Hi,
    Thanks for your help!!

    I have had to make a little variation:

    .my-extra-widget {
        max-width: 96%;
        float: none;
        margin: 0 auto;
    }

    Now it works perfectly.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with header widget’ is closed to new replies.