【发布时间】:2013-01-01 13:45:50
【问题描述】:
我想创建一个自定义页面,该页面将显示 20 个最新的画廊/页面 - 但只有画廊中的第一张图片,而不是所有图片。像这样:http://www.autoblog.it/gallerie/
我已经这样做了:
<?php
$args = array(
'post_type' => 'attachment',
'posts_per_page' => 10,
'post_parent' => $postid,
'numberposts' => 1,
'paged' => $paged,
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo the_attachment_link($attachment->ID, false, false, true )
echo get_the_title(); }
}?>
它可以工作,但它的作用是显示最新的 10 张图片,而不是最新的 10 张画廊,所以每个画廊的第一张图片。
请帮忙
谢谢
【问题讨论】:
-
¿如何识别不同的画廊?
标签: wordpress gallery image-gallery