Register a new sidebar


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

This code must be added to functions.php in the child theme


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. function my_sidebar() {
  4. register_sidebar( array(
  5. 'name' => __( 'Sidebar', 'theme' ),
  6. 'id' => 'widget-1',
  7. 'description' => 'This is a sidebar',
  8. 'class' => 'content',
  9. 'before_widget' => '<div id="widget-1" class="widget widget-1">',
  10. 'after_widget' => "</div></div>",
  11. 'before_title' => '<div class="widget-title">',
  12. 'after_title' => '</div><div class="widget-content">',
  13. ) );
  14. }
  15. add_action( 'widgets_init', 'my_sidebar' );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.