Add sidebar in template in WP


/ Published in: PHP
Save to your folder(s)

Add a sidebar to a WP template


Copy this code and paste it in your HTML
  1. <?php
  2. /**
  3.  * The sidebar containing the footer widget area
  4.  *
  5.  * If no active widgets in this sidebar, hide it completely.
  6.  *
  7.  * @package WordPress
  8.  * @subpackage Twenty_Thirteen
  9.  * @since Twenty Thirteen 1.0
  10.  */
  11.  
  12. if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
  13. <div id="secondary" class="sidebar-container" role="complementary">
  14. <div class="widget-area">
  15. <?php dynamic_sidebar( 'sidebar-1' ); ?>
  16. </div><!-- .widget-area -->
  17. </div><!-- #secondary -->
  18. <?php endif; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.