How can I specify that an area of my custom WordPress theme have to contains widgets\modules?
I am pretty new in WordPress theme development and I am developing a theme that use BootStra CSS framework
I have to do that a specific area of my theme can contains some widget\module (I don't know what is the correct name in WP, I am refering to the tool setted by backend that show some components output as a gallery immage or a slideshow)
Someone can help me to understand this argument? from what can I start to do this operation?
Welcome to wordpress :)
So first thing is to register widget area. In you
functions.php place the following code:
$args = array( 'name' => __( 'Sidebar name', 'theme_text_domain' ), // name that will show up in the admin 'id' => 'unique-sidebar-id', 'description' => '', 'class' => '', 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' ); register_sidebar( $args );
For the reference see official codex page
dynamic_sidebar() function where you want the content to show up on the site, usually
<?php if ( is_active_sidebar( 'unique-sidebar-id' ) ) : ?> //display widget area only if there are widgets asigned in the admin <ul id="sidebar"> <?php dynamic_sidebar( 'unique-sidebar-id' ); ?> </ul> <?php endif; ?>
I hope this will get you started.