$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);
}
}
Dalam kode di atas, ada cara untuk mendapatkan:
Semua tautan lampiran kecuali gambar unggulan.
Semua tautan lampiran PDF saja.
Saya sedang membaca:
attachments
José Pablo Orozco Marín
sumber
sumber