dongxiji0687 2012-02-27 14:37
浏览 51
已采纳

Wordpress:附件库仅显示5张图片

I am pulling in all the attachment images for a page into a template, so that I can use a Jquery Galleriffic gallery on them.

The gallery works fine, but for some reason it is only displaying 5 thumbnails, this is not being controlled by the Galleriffic plugin, it is limiting the thumbnails before it gets to reading the Jquery file.

Here is the code for how I am pulling in the attachments:

<?php $images = get_posts("post_mime_type=image&post_type=attachment&orderby=menu_order ID&order=ASC&post_parent=$post->ID");  // we get array of images ?>


                            <?php if(!empty($images)) foreach($images as $img) : ?>
                                <li><a class="thumb" href="<?php echo array_shift( wp_get_attachment_image_src($img->ID,"large") ); ?>"><img src="<?php echo array_shift( wp_get_attachment_image_src($img->ID,"thumbnail") ); ?>" alt="<?php echo esc_attr($img->post_title); ?>" /></a></li>
                            <?php endforeach; ?>

Can anybody help me?

  • 写回答

1条回答 默认 最新

  • drvpv7995 2012-02-27 14:41
    关注

    Looks like the default amount of posts returned is 5 (see also the documentation)

    Try updating that.

    So add &numberposts=100 (for example 100 here)

    ps: For the sake of readability make it an array as displayed on the docs linked above

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度