Posted By

gd6d on 01/15/10


wordpress sidebar

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Choose the sidebar to use, post by post

 / Published in: PHP


  1. Simply open single.php* and find the call to the get_sidebar() function:
  3. <?php get_sidebar(); ?>
  4. Replace it by:
  6. <?php $sidebar = get_post_meta($post->ID, "sidebar", true);
  7. get_sidebar($sidebar);
  8. ?>
  9. Now when you'll write a post, create a custom field name sidebar. As a value, give it the name of the sidebar you want to include. For example, if the value given is right, WordPress will automatically inlcude right.php as a sidebar.

Report this snippet  

You need to login to post a comment.