yad4u get attached image in Wordpress

get attached image in Wordpress

i can use <?php the_content();?> to get all post contents but how can i show only the image attached to the post?


How to show custom page as Wordpress theme home page instead of index.php


Adding next and previous buttons to static pages in wordpress?Utilizing WordPress's permalink structure on custom post typesWordpress wp_options option question?


wordpress blog styling
You must create a query this lists all the posts with images and then use wp_receive _attachment_url, wp_receive _attachment_image, or wp_receive _attachment_link. Multiple Custom Permalink Structures in Wordpress The code below receive s all image attachments from all posts then displays them in a loop (i.e. WordPress TEMPLATEPATHfor an image gallery)..
<ul>         <?php         $wp_query = new WP_Query(array('post_type' => 'attachment','post_mime_type' =>'image','post_status' => 'inherit', 'posts_per_page' => '20', 'orderby' => 'date','order' => 'DESC'));         if($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();?>                 <li>                 <a href="<?php echo wp_receive _attachment_url($post->ID); ?>"                 class="post-images"                 title="<?php the_title(); ?>" >                 <img width="100" height="100" src="<?php echo wp_receive _attachment_thumb_url( $post->ID);?>" /></a>                 </li>         <?php endwhile; ?>         </ul> 

91 out of 100 based on 66 user ratings 401 reviews