I want to take the text widget and remove the preceding / trailing markup from the text output currently showing as
<div class="textwidget">Test</div>
The before_widget / after_widget that is assigned with each widget area is under my control but the widget content itself is beyond me.
// Area 4, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'First Footer Widget Area', 'lakeshoreautoclinic' ),
'id' => 'first-footer-widget-area',
'description' => __( 'The first footer widget area', 'lakeshoreautoclinic' ),
'before_widget' => ' <p>',
'after_widget' => '</p>',
'before_title' => '<strong>',
'after_title' => '</strong>',
) );
which outputs this for the surrounding / widget
<p><strong>Test</strong><div class="textwidget">Test</div></p>
2 Answers
You have a couple options as I see it:
There’s a the_widget() template tag that lets you control the before_widget and after_widget properties. However, it divorces the widget from the Widgets UI.
Alternately, you can try to accomplish whatever you’re trying to do via CSS. If you change your before_widget line to this:
'before_widget' => '<p id="%1$s" class="widget %2$s">',
you’ll get some classes and IDs that will make each widget style-able.