Reputation: 43027
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?
Tnx
Andrea
Upvotes: 0
Views: 30
Reputation: 1056
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
Next, call dynamic_sidebar()
function where you want the content to show up on the site, usually sidebar.php
<?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.
Upvotes: 1