Munkhbayar Yo
Munkhbayar Yo

Reputation: 119

Wordpress widget title out of container

How can I move widget title out of container ?

Desired output:

<h2 class="at-widget-title"><span>Recent Posts</span></h2>  
   <div class="at-widget-container widget_recent_entries" id="recent-posts-2">      
</div>

My function:

function arphabet_widgets_init() {

    register_sidebar( array(
        'name' => 'SideBar',
        'id' => 'side_bar_1',
        'before_widget' => '<div class="at-widget-container %2$s" id="%1$s">',
        'after_widget' => '</div>',
        'before_title' => '<h2 class="at-widget-title"><span>',
        'after_title' => '</span></h2>',
    ) );
}

My output:

<div class="at-widget-container widget_recent_entries" id="recent-posts-2">     
    <h2 class="at-widget-title"><span>Recent Posts</span></h2>      
</div>

Upvotes: 1

Views: 245

Answers (1)

Aibrean
Aibrean

Reputation: 6412

function arphabet_widgets_init() {

    register_sidebar( array(
        'name' => 'SideBar',
        'id' => 'side_bar_1',
        'before_widget' => '',
        'after_widget' => '</div>',
        'before_title' => '<h2 class="at-widget-title"><span>',
        'after_title' => '</span></h2><div class="at-widget-container %2$s" id="%1$s">',
    ) );
}

You just need to move the order around very slightly.

Upvotes: 1

Related Questions