Add Wordpress Widgetized Areas


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



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.