Wordpress sidebar script for the function.php file


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

Standard script to create sidebar in Wordpress


Copy this code and paste it in your HTML
  1. <?php
  2. if ( function_exists('register_sidebar') )
  3. register_sidebar(array(
  4. 'name' => 'Right Sidebar',
  5. 'before_widget' => '<div class="mywidgets>',
  6. 'after_widget' => '</div>',
  7. 'before_title' => '<h2>',
  8. 'after_title' => '</h2>',
  9. ));
  10. ?>
  11.  
  12. And in the Sidebar.php call the above with
  13.  
  14. <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Right Sidebar") ) : ?>
  15. <?php endif; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.