Thursday, September 13, 2012

take all images in the wordpress site


<?php
$post_parent = get_post($post->ID, ARRAY_A);
$parent = $post_parent['post_parent'];

$attachments = get_children( array( 'post_parent' => $post_id, 
'post_type' => 'attachment', 
'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
foreach($attachments as $id => $attachment) :
 echo wp_get_attachment_link($id, 'thumbnail', true);
endforeach;
?>

No comments:

Post a Comment