Displaying widget title inside the before_widget variable
-
Hello,
I’m new to the wordpress community. I’m building a custom wordpress theme for my website and I need some help with its costumization.
The thing I am struggling to do is to display the widget title in the “before_widged” variable. Why I want to do this ? Well I will try to explain:I have wrapped the widget contents in a number of <div> tags. These divs are forming a content box. Its structure is as follows:
<div class="box_container_mid"> <div class="boxheadl"></div><div class="boxheadr"></div> <div class="boxcontent"> <div class="cont1"></div> <div class="cont2"></div> <div class="cont3"</div> </div> <div class="boxfooter"> <div class="boxfl"></div> <div class="boxfr"></div> </div> </div>
the way I make my widgets appear in that “box” is by changing some stuff in functions.php in my theme folder:
// Define Sidebar Widget Area 1 register_sidebar(array( 'name' => __('Widget Area 1', 'mytheme'), 'description' => __('Description for this widget-area...', 'mytheme'), 'id' => 'widget-area-1', 'before_widget' => '<div class="box_container_mid"><div class="boxheadl"></div><div class="boxheadr"></div><div class="boxcontent"><div class="cont1"></div><div class="cont2"></div><div class="cont3">', 'after_widget' => '</div></div><div class="boxfooter"><div class="boxfl"></div><div class="boxfr"></div></div></div><div class="leftspacer"></div>', 'before_title' => '<h3>', 'after_title' => '</h3>' ));
So what I want to do is put the widget title between the <div class=”boxeadl”> and its closing </div> tag, thats where I need the title do appear. How do I do that ?
I also had a look at widgets.php and default_widget.php files tried to think of something myself, but with no success. I will be extremely thankfull if someone helps me with that.
- The topic ‘Displaying widget title inside the before_widget variable’ is closed to new replies.