我使用get\\u posts()从帖子中获取附件,并在滑块中使用它。问题是,新的上传程序没有“Gallery”标签,这非常适合这个标签。它似乎也破坏了原始代码,您现在无法从这个新上传程序中删除/重新排序图像。有没有办法解决这个问题?
代码如下:
<ul class="slides">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$args = array(
\'post_type\' => \'attachment\',
\'numberposts\' => -1,
\'post_status\' => null,
\'post_parent\' => $post->ID,
\'order\'=> \'ASC\',
\'orderby\' => \'menu_order\'
);
$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
echo \'<li>\';
echo wp_get_attachment_image( $attachment->ID, \'full\' );
echo \'</li>\';
}
}
endwhile; endif; ?>
</ul>
<!-- slider ends -->