Advertisement
Mushir

Use a Default Category Post Thumbnail

Jan 20th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  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="alignright" src="<?php echo get_stylesheet_directory_uri(); ?>/images/<?php $category = get_the_category(); echo $category[0]->slug; ?>.png" />
  10.  
  11.     <?php endif;?>
  12. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement