Want more features on Pastebin? Sign Up, it's FREE!
Guest

Spun content-home.php

By: a guest on Jan 26th, 2014  |  syntax: PHP  |  size: 1.19 KB  |  views: 35  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3.  * @package Spun
  4.  * Modification: Adding custom links to text under circles
  5.  */
  6.  
  7. /*
  8.  * Get the post thumbnail; if one does not exist, try to get the first attached image.
  9.  * If no images exist, let's print the post title instead.
  10.  */
  11. $restore_widont = remove_filter( 'the_title', 'widont' );
  12. $postclass = '';
  13. $spun_image = spun_get_image( get_the_ID() );
  14. $circle_text_link = get_custom_field('circle_text_link');
  15. $circle_text = '<span class="thumbnail-title no-thumbnail">' . get_the_title() . '</span>';
  16.  
  17. if ( !empty( $circle_text_link ) ) {
  18.     $circle_text = "<a class='circle-link-text' href='$circle_text_link'> $circle_text </a>";
  19. }
  20.  
  21. if ( '' != $spun_image ) :
  22.         $thumb = $spun_image;
  23. else :
  24.         $thumb = $circle_text;
  25.         $postclass = 'no-thumbnail';
  26. endif;
  27.  
  28. if ( 'no-thumbnail' != $postclass ) :
  29.         $thumb .= $circle_text;
  30. endif;
  31. ?>
  32.  
  33. <article id="post-<?php the_ID(); ?>" <?php post_class( $postclass ); ?>>
  34.         <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo $thumb; ?></a>
  35. </article><!-- #post-<?php the_ID(); ?> -->
  36.  
  37. <?php if ( $restore_widont )
  38.                 add_filter( 'the_title', 'widont' ); ?>
clone this paste RAW Paste Data