WP Snippets: add new Widget (Sidebar)


  • Open functions.php
  • Find register_sidebar
  • paste before the closing function } bracket:
// New Widget Area
// Location: at the top of the gallery page
register_sidebar(array(
   'name' => __("New Widget Area", CURRENT_THEME),
   'id' => 'new-widget-area-sidebar',
   'description' => __("New Widget Area", CURRENT_THEME),
   'before_widget' => '<div id="%1$s">',
   'after_widget' => '</div>',
   'before_title' => '<h4>',
   'after_title' => '</h4>',
));
  • paste in to (custom / template) page the widget code:
<?php if (!dynamic_sidebar('New Widget Area')) :?> <?php endif;?>