• Resolved giorjoe

    (@giorjoe)


    How can put extra widget area after slider? This is code for extra widget:

    // 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 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’, 0);
    function add_my_widget_area() {
    if (function_exists(‘dynamic_sidebar’)) {
    dynamic_sidebar(‘Extra Header Widget Area’);
    }
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • Remember to use unique ids (and also names) for each widget areas you add.
    And replace
    add_action ('__after_header', 'add_my_widget_area', 0);
    with
    add_action ('__after_header', 'add_my_widget_area', 20);

    Thread Starter giorjoe

    (@giorjoe)

    Ok Thanks D4, really thanks… you are very good boy

    Thank you giorjoe ??

    Hey giorjoe, I was thinking, do you want to show that widget area just in the home page?
    In this case you need to add a condition.
    If so, use this:

    add_action ('__after_header', 'add_my_widget_area', 20);
    function add_my_widget_area() {
    if ( ! tc__f('__is_home') )
        return;
    if (function_exists('dynamic_sidebar')) {
        dynamic_sidebar('Extra Header Widget Area');
    }
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘extra widget area after slider’ is closed to new replies.