Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Use a Default Category Post Thumbnail

Mushir Jan 20th, 2014 36 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. <!-- Conditional thumbnail for categories -->
  2. <div class="excerpt-thumb">
  3.         <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())) : ?>
  4.                 <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
  5.                 <?php the_post_thumbnail('excerpt-thumbnail', 'class=alignleft'); ?>
  6.                 </a>
  7.         <?php else :?>
  8.         <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
  9.                 <img class="alignleft" src="<?php echo get_stylesheet_directory_uri(); ?>/images/<?php $category = get_the_category(); echo $category[0]->slug; ?>.png" />
  10.  
  11.         <?php endif;?>
  12. </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top