milardovich

Thumbs not showing - Wordpress

Dec 15th, 2011
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1.                     $args = array(
  2.                         'showposts'         => 1,
  3.                         'posts_per_page'    => 1,
  4.                         'offset' => $featured_offset
  5.                     );
  6.                     $featured = new WP_Query($args);
  7.                     if($featured -> have_posts()) : while($featured -> have_posts()) : $featured -> the_post();
  8.                 ?>
  9.                 <div class="post-featured">
  10.                     <div class="the-thumbnail">
  11.                         <?php
  12.                             $args = array( 'post_type' => 'attachment', 'post_parent' => get_the_ID() );
  13.                             $attachments = get_posts($args);
  14.                             if ($attachments) {
  15.                                 $gambar = wp_get_attachment_image_src( $attachments[0]->ID, 'medium', false);
  16.                         ?>
  17.                                     <img src="<?php echo $gambar[0]?>" />
  18.                         <?php
  19.                             }
  20.                         ?>
  21.                     </div>
Advertisement
Add Comment
Please, Sign In to add comment