$args = array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo apply_filters('the_title', $attachment->post_title);
the_attachment_link($attachment->ID, false);
}
}
在上面的代码中,存在一种获取方法:
除特色图片外,所有附件链接。
仅所有PDF附件链接。
我正在阅读: