I have a normal textbox widget that I am using in certain sidebars. The text widget generates a div within a ul. Is there anyway to make the widget generate another ul li instead?
<ul><h3>Heading</h3> <div class="textwidget">
I have a normal textbox widget that I am using in certain sidebars. The text widget generates a div within a ul. Is there anyway to make the widget generate another ul li instead?
<ul><h3>Heading</h3> <div class="textwidget">
check your sidebar.php
and functions.php
of the theme, the sidebar define the markup outside the widget; the function register_sidebar()
defines the markup before content of the widgets; this markup you must change.
See the codex for this function: codex register_sidebar()
Specifically, you need to look at the before_widget
and after_widget
parameters of the register_sidebar()
arguments array.
If the register_sidebar()
call looks like this:
register_sidebar(array( // Right Column widget area
'name'=>'Sidebar Right',
'id'=>'sidebar-right',
'description' => 'Right-column, half-width sidebar in three-column layout',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<div class="title">',
'after_title' => '</div>',
));
Then change it to this:
register_sidebar(array( // Right Column widget area
'name'=>'Sidebar Right',
'id'=>'sidebar-right',
'description' => 'Right-column, half-width sidebar in three-column layout',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<div class="title">',
'after_title' => '</div>',
));
Specifically, you’re changing this:
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
To this:
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',