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 referring to the settings in the backend that show some components output as a gallery image or a slideshow.

Someone can help me to understand this argument? from what can I start to do this operation?

  • Sorry, what argument? In general, what you need is register_sidebar (I think). For example: wordpress.stackexchange.com/a/95459/21376 but the question is not entirely clear. – s_ha_dum Feb 7 '14 at 16:00
  • mine is not a sidebar but a specific area into the content area – AndreaNobili Feb 7 '14 at 16:11
  • 1
    Your question is confusing. "Widgets" live in "Sidebars", though the sidebar doesn't have to be on the side at all. – s_ha_dum Feb 7 '14 at 16:17
  • ah ok, so the "Sidebars" can be put also in other locations that are not the classic side bar area of a theme? So can I put a Sidebar into my content? is it right? – AndreaNobili Feb 7 '14 at 16:33
  • 1
    You can put "sidebars" just about anywhere you want. If by "the content" you mean the post body content you may be looking for a shortcode instead. – s_ha_dum Feb 7 '14 at 16:38

You can add widgets conditionally by adding a conditional tag in your template file.

You also mentioned a image slider.

You can conditionally load the slider so it only displays where you want like the front page only.

An example would be to add this code in your header.php file so the slider only loads on the front page.

<?php if (function_exists('slider_template_tag') && is_front_page()) { slider_template_tag('82'); }?>

You can do the same with the widgets.

<?php if ( is_active_sidebar( 'left-sidebar' ) && is_page('007') ) : ?>
<ul id="sidebar">
    <?php dynamic_sidebar( 'left-sidebar' ); ?>
<?php endif; ?>

This displays the widget area only on the page with i.d of 007.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.