WordPress Getting Page Images
Having a little trouble here, I'm wanting to get all images from posts and display them in two separate locations, one location showing one image and the second location showing all the image.
If i use the Query it grabs all post image and with out using Query it grabs one image from the page. any ideas on how to get all images from page instead of posts???
<div id="fp_gallery" class="fp_gallery">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $args = array( 'numberposts' => 1, 'post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image' ,'post_status' => null, 'post_parent' =>
$post->ID ); $attachments = get_posts($args); if ($attachments) { foreach ( $attachments as $attachment ) { ?>
<img src="<?php echo wp_get_attachment_url( $attachment->ID , false ); ?>" alt="" class="fp_preview" style=""/>
<?php }}?>
<?php endwhile; endif; ?>
<div class="fp_overlay"></div>
<div id="fp_loading" class="fp_loading"></div>
<div id="fp_next" class="fp_next"></div>
<div id="fp_prev" class="fp_prev"></div>
<div id="outer_container">
<div id="thumbScroller">
<div class="container">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $args = array( 'numberposts' => 9999, 'post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image' ,'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args); if ($attachments) { foreach ( $attachments as $attachment ) { ?>
<div class="content">
<div>
<a href="#" title="<?php the_title(); ?>">
开发者_StackOverflow <img src="<?php echo get_bloginfo('template_url');?>/js/timthumb.php?src=<?php echo wp_get_attachment_url( $attachment->ID , false ); ?>&h=120&w=150&zc=1" alt="<?php echo wp_get_attachment_url( $attachment->ID , false ); ?>" class="thumb"/>
</a>
</div>
</div>
<?php }}?>
<?php endwhile; endif; ?>
</div>
</div>
</div>
</div>
<div id="fp_thumbtoggle" class="fp_thumbtoggle" title="View Thumbs">↑</div>
Any help would be great : )
Make numberposts -1 it will collect all posts under category
$args = array( 'numberposts' => 1, 'post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image' ,'post_status' => null, 'post_parent' =>
$post->ID );
But i'm not sure about jQuery thing you are talking about.
精彩评论