Is there any way to add two new functions, before_content
and after_content
to the register_sidebar
function? These would work like before_title
and after_title
, except it would wrap everything that comes after the title.
I've found this thread which has some useful information, but every mentioned approach has flaws.
For example, inserting the required code in after_title
and after_widget
can result in broken code if a title isn't set. The solution would be to duplicate the opening div in before_widget
and close it out again in before_title
then reopen it in before_title
, but that creates an empty div if a title is set.
Ideally, I'd like to do this:
register_sidebar(array(
"id" => "sidebar",
"name" => "Sidebar",
"before_widget" => "<div class='box box_push'>",
"before_title" => "<div class='box-hd'>",
"after_title" => "</div>",
"before_content" => "<div class='box box-bd'>"
"after_content" => "</div>";
"after_widget" => "</div>",
));
Which would output as:
<div class="box box_push">
<div class="box-hd">
<!-- widget title -->
</div>
<div class="box box-bd">
<!-- widget content-->
</div>
</div>