Wordpress - 2 or more sidebars


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



Copy this code and paste it in your HTML
  1. -----------------------------------
  2. Functions.php
  3. -----------------------------------
  4.  
  5. if ( function_exists('register_sidebar') )
  6. register_sidebar(array('name'=>'sidebar1',
  7. 'description' => 'This shows in admin widget header.',
  8. 'before_widget' => '',
  9. 'after_widget' => '',
  10. 'before_title' => '<h4>',
  11. 'after_title' => '</h4>',
  12. ));
  13.  
  14. register_sidebar(array('name'=>'sidebar2',
  15. 'description' => 'This shows in admin widget header.',
  16. 'before_widget' => '',
  17. 'after_widget' => '',
  18. 'before_title' => '<h4>',
  19. 'after_title' => '</h4>',
  20. ));
  21.  
  22. -----------------------------------------
  23. Sidebar.php
  24. -----------------------------------------
  25.  
  26. <?php /* Widgetized sidebar, if you have the plugin installed. */
  27. if ( !function_exists('dynamic_sidebar')
  28. || !dynamic_sidebar('sidebar1') ) : ?>
  29. <?php endif; ?>
  30.  
  31. -----------------------------------------
  32. Sidebar2.php
  33. -----------------------------------------
  34.  
  35. <?php /* Widgetized sidebar, if you have the plugin installed. */
  36. if ( !function_exists('dynamic_sidebar')
  37. || !dynamic_sidebar('sidebar2') ) : ?>
  38. <?php endif; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.