Support
Support » Themes and Templates » How does dynamic_sidebar() knows what style to use?
(@extrakun)
15 years ago
Out of curiosity, I have been looking at the sidebar.php of my template (modern notepad):
<div id="right-block"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?> <div class="box categories"> <div class="header"> <h3><?php _e('Category:'); ?></h3> </div> <ul> <?php wp_list_cats('sort_column=name&hierarchical=1'); ?> </ul> </div> ...snipped... </div><!--#right-block-->
I understand that dynamic_sidebar() renders the widgets; what is puzzling to me is how does dynamic_sidebar() knows what style to use? Each of the widget is using the .box class for each div.
How does this happens?
(@otto42)
WordPress.org Admin
Stuff like that is defined in the theme’s functions.php file, where it initially creates the sidebars.