Advertisement
Guest User

Spun content-custom-circles.php

a guest
Jan 13th, 2014
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.11 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. /* Get custom circles */
  5.         $args = array(
  6.                 'post_type' => 'custom_circles'
  7.         );
  8.  
  9.         $custom_circles = new WP_Query( $args );
  10.  
  11.         if( $custom_circles->have_posts() ) {
  12.  
  13.                 while( $custom_circles->have_posts() ) {
  14.  
  15.                         $custom_circles->the_post();
  16.  
  17.                         // Get the link
  18.                         $link = get_custom_field( 'link' );
  19.  
  20.                         //Add in "http://" if it isn't there already
  21.                         if ( strpos( $link, 'http://' ) === false ) {
  22.                             $link = 'http://' . $link;
  23.                         }
  24.  
  25.                         // I don't know how to return something useful from
  26.                         // get_custom_field that'll let me know if no image
  27.                         // has been specified, so I'm doing this elongation:
  28.                         // Convert the image to an integer
  29.                         $image_id = (int) get_custom_field( 'image:wrapper');
  30.  
  31.                         //If it's more than zero then it has matched
  32.                         if ( $image_id !== 0 ) {
  33.                                 $thumb_id = get_custom_field( 'image' );
  34.                                 $thumb = wp_get_attachment_image($thumb_id, 'home-post wp-post-image');
  35.                                 $thumb .= '<span class="hometitle">' . esc_attr( the_title_attribute( 'echo=0' ) ) . '</span>';
  36.                         }
  37.                         else {
  38.                                 $thumb = '<span class="thumbnail-title no-thumbnail">' . esc_attr( the_title_attribute( 'echo=0' ) ) . '</span>';
  39.                                 $postclass = 'no-thumbnail';
  40.                         }
  41.  
  42.                         ?>
  43.  
  44. <article id="post-<?php the_ID(); ?>" <?php post_class( $postclass ); ?>>
  45.         <a href="<?php echo $link; ?>" title="<?php the_title() ?>" rel="bookmark">
  46.             <?php echo $thumb; ?>
  47.         </a>
  48. </article><!-- #post-<?php the_ID(); ?> -->
  49.  
  50.                                 <?php
  51.                         }
  52.  
  53.                 }
  54.  
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement