Advertisement
elbatron

all img from all posts

Dec 7th, 2011
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2.                     $query = new WP_Query( array( 'post_type' => 'post', 'posts_per_page' => -1 ) );
  3.                     if( $query->have_posts() ){
  4.                     while($query->have_posts()){
  5.                     $query->the_post();
  6.                     $image_query = new WP_Query( array( 'post_type' => 'attachment',  'post_status' => 'inherit', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID() ) );
  7.                     while( $image_query->have_posts() ) {
  8.                     $image_query->the_post();
  9.                     echo '<dl class="gallery-item"><dt class="gallery-icon"><a rel="shadowbox[sbalbum-1];player=img;" href="' , the_permalink() , '">', wp_get_attachment_image( get_the_ID() ) , '</a></dt></dl>';
  10.                     }
  11.                     }
  12.                     }
  13.                     ?>
  14.                     <?php wp_reset_query(); ?>
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement