Retrieving page attachment URL
-
Hi,
I’m trying to create a page template that shows the post title, excerpt and a link to the attachment.
I’ve been using this code:
<?php $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); } }?>which is great and pulls the post attachment but it uses the document title as the link name like this:
POST TITLE / POST EXCERPT / DOCUMENT23 .DOC
How do I achieve this:
POST TITLE / POST EXCERPT / CLICK HERE TO DOWNLOAD
Any help much appreciated,
Thanks,
Jon.
The topic ‘Retrieving page attachment URL’ is closed to new replies.