Wordpress Conditional Tags In Action (Different Sidebars)


/ Published in: PHP



Copy this code and paste it in your HTML
  1. <?php if ( is_front_page() ) {?>
  2. <div id="home_sidebar">
  3. ...sidebar content.....
  4. </div>
  5. <?php } /* end home_sidebar */ ?>
  6.  
  7. <?php if ( is_page() && !is_front_page() ) {?>
  8. <div id="pages_sidebar">
  9. ...sidebar content.....
  10. </div>
  11. <?php } /* end pages_sidebar */ ?>
  12.  
  13. <?php else {?>
  14. <div id="blog_sidebar">
  15. ...sidebar content.....
  16. </div>
  17. <?php } /* end blog_sidebar */ ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.