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?

Thanks




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

1:



Adding next and previous buttons to static pages in wordpress?


Utilizing WordPress's permalink structure on custom post types


Wordpress wp_options option question?

2:



wordpress blog styling
You can create a query that lists all the posts with images and then use wp_get_attachment_url, wp_get_attachment_image, or wp_get_attachment_link.


Multiple Custom Permalink Structures in Wordpress
The code below gets all image attachments from all posts then displays them in a loop (i.e.


WordPress TEMPLATEPATH
for 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_get_attachment_url($post->ID); ?>"                 class="post-images"                 title="<?php the_title(); ?>" >                 <img width="100" height="100" src="<?php echo wp_get_attachment_thumb_url( $post->ID);?>" /></a>                 </li>         <?php endwhile; ?>         </ul> 



71 out of 100 based on 46 user ratings 271 reviews