2011-07-25 17 views
0

ここでは少し問題がありますが、投稿からすべての画像を取得し、1つの画像を表示する1つの場所とすべての画像を表示する2つ目の場所に表示する必要があります。ワードプレス画像取得

私はそれをすべての投稿画像を取得し、クエリを使用して、それはページから1つの画像をつかむクエリを使用する場合。投稿の代わりにページからすべての画像を取得する方法に関するアイデア???

<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(); ?>"> 
             <img src="<?php echo get_bloginfo('template_url');?>/js/timthumb.php?src=<?php echo wp_get_attachment_url($attachment->ID , false); ?>&amp;h=120&amp;w=150&amp;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">&uarr;</div> 

すべてのヘルプは素晴らしいことだ:)

答えて

0

それは、カテゴリ

$args = array('numberposts' => 1, 'post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image' ,'post_status' => null, 'post_parent' => 
     $post->ID); 

下のすべての記事を収集しますnumberposts -1してくださいしかし、私は、あなたが話しているjQueryのものについてはよく分かりません約。

+0

彼は言う/書く:>クエリはjQueryではない。 – drmartin

+0

@DrMartin:どういう意味ですか?私はOPに正しい主張をした – Gowri

関連する問題