Advertisement
Viper007Bond

Untitled

Nov 29th, 2011
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div class="front-pg-container-left">
  2.     <?php
  3.  
  4.         global $post;
  5.         $args = array( 'numberposts' => 2, 'category' => 0 );
  6.         $myposts = get_posts( $args );
  7.         foreach( $myposts as $post ) :  setup_postdata($post);
  8.             $image = wp_get_attachment_image_src( get_post_thumbnail_id() );
  9.             $image_url = $image[0];
  10.  
  11.             echo 'ID is ' . get_post_thumbnail_id() . ' and result is ';
  12.             var_dump( $image );
  13.     ?>
  14.             <div class="front-page-second" style="background-image: url('<?php echo esc_url( $image_url ); ?>');">
  15.                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  16.             </div>
  17.         <?php endforeach; ?>
  18. </div>
  19.  
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement