Posted By

kbrown on 06/30/11


Tagged

php wordpress categories


Versions (?)

Wordpress PHP Detect category a post is in


 / Published in: PHP
 

  1. <?php
  2. $post = $wp_query->post;
  3.  
  4. if ( in_category('press-releases')) {
  5. echo '<div class="backToMain"><a href="/buyers-news/category/press-releases/">&lt; Back to Press Releases</a></div>';
  6. } else if ( in_category('media-coverage')) {
  7. echo '<div class="backToMain"><a href="/buyers-news/category/media-coverage/">&lt; Back to Media Coverage</a></div>';
  8. } else {
  9. echo '<div class="backToMain"><a href="/buyers-news/category/media-coverage/">&lt; Back</a></div>';
  10. }
  11.  
  12. ?>

Report this snippet  

You need to login to post a comment.