Posted By

adambundy on 04/28/10


Tagged

php wordpress widgets sidebars


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

adambundy
BrianCoyDesign
pitrih
laurentzziu
marclarr


Add Wordpress Widgetized Areas


 / Published in: PHP
 

  1. in functions.php
  2.  
  3. <?php
  4. if ( function_exists('register_sidebar') )
  5. register_sidebar(array('name'=>'sidebar1',
  6. 'before_widget' => '',
  7. 'after_widget' => '',
  8. 'before_title' => '<h4>',
  9. 'after_title' => '</h4>',
  10. ));
  11. register_sidebar(array('name'=>'sidebar2',
  12. 'before_widget' => '',
  13. 'after_widget' => '',
  14. 'before_title' => '<h4>',
  15. 'after_title' => '</h4>',
  16. ));
  17. ?>
  18.  
  19. in template:
  20.  
  21. <?php if ( !function_exists('dynamic_sidebar')
  22. || !dynamic_sidebar('sidebar1') ) : ?>
  23. <?php endif; ?>
  24.  
  25. <?php if ( !function_exists('dynamic_sidebar')
  26. || !dynamic_sidebar('sidebar2') ) : ?>
  27. <?php endif; ?>

Report this snippet  

You need to login to post a comment.