Show WordPress post attachments – WordPress

$args = array(
‘post_type’ => ‘attachment’,
‘numberposts’ => null,
‘post_status’ => null,
‘post_parent’ => $post->ID
);
$pczAttachments = get_posts($args);
if ($pczAttachments) {
foreach ($pczAttachments as $values) {
echo apply_filters(‘the_title’, $values->post_title);
the_attachment_link($values->ID, false);
}
}

Share

Leave a Reply

Your email address will not be published. Required fields are marked *