WordPress获取页面图像
这里有点麻烦,我想从帖子中获取所有图像,并将它们显示在两个单独的位置,一个位置显示一个图像,另一个位置显示所有图像 如果我使用查询,它会抓取所有post图像,如果不使用查询,它会从页面中抓取一个图像。关于如何从页面而不是帖子中获取所有图像,有什么想法吗WordPress获取页面图像,wordpress,post,Wordpress,Post,这里有点麻烦,我想从帖子中获取所有图像,并将它们显示在两个单独的位置,一个位置显示一个图像,另一个位置显示所有图像 如果我使用查询,它会抓取所有post图像,如果不使用查询,它会从页面中抓取一个图像。关于如何从页面而不是帖子中获取所有图像,有什么想法吗 <div id="fp_gallery" class="fp_gallery"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?&g
<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 ); ?>&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>
ID,false);?>“alt=”“class=“fp_预览”style=”“/>
&uarr;
任何帮助都很好:)Makenumberposts-1它将收集类别下的所有帖子
$args = array( 'numberposts' => 1, 'post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image' ,'post_status' => null, 'post_parent' =>
$post->ID );
但我不确定你们所说的jQuery是什么意思。他说/写:>不要jQuery。@martin博士:你们是什么意思。我希望,我给OP提供了正确的论据