Advertisement
alchymyth

category logo

Jun 14th, 2011
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <h1 id="logo">
  2. <?php
  3. $in_news = 0; // set a flag varable to false
  4.   if( is_category() && in_array( '23', get_ancestors( get_query_var('cat'), 'category' ) ) ) $in_news = 1; // set flag to true
  5.   if( is_single() ) {
  6.     $cats = get_the_category();
  7.     foreach ( $cats as $cat ) {
  8.     if( in_array( '20', get_ancestors( $cat, 'category' ) ) ) $in_news = 1; // set flag to true
  9.     }
  10.   }
  11. if( $in_news == 1 || is_category(23)) : ?>
  12. <a href="http://localhost/test"><img width="345" height="176" src="http://localhost/test/wp-content/uploads/logo-old.png"></a>
  13. <?php else : ?>
  14. <a href="http://localhost/test"><img width="345" height="176" src="http://localhost/test/wp-content/uploads/logo.png"></a>
  15. <?php endif; ?>
  16. </h1>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement