Attachment URL for a PDF Link
-
I am having some trouble (probably something I am doing wrong) with showing a link to a PDF that I am adding to a custom post type with the upload field. I am getting a link to show that looks right but the URL itself is not correct.
<?php $pdfdownloadlink = get_post_meta($post->ID, 'pdfdownloadlink', true); foreach($pdfdownloadlink as $pdfdownloadlink) { $file_attributes = wp_get_attachment_url( $pdfdownloadlink['file-upload'] ); echo '<a href="' . $file_attributes[0] . '" >'; echo $pdfdownloadlink['file-link-name']; } ?>
pdfdownloadlink = Meta Box Argument
file-upload = The Upload Field
file-link-name = A Text Field for the text that shows the linkThe temp URL for an example of this is: https://buffalomedia.net/hosted-sites/nyafp/event/htst/
In this example the URL that is supposed to be showing under “File Download” would be: https://buffalomedia.net/hosted-sites/nyafp/wp-content/uploads/2013/03/HTST.pdf
The URL it is showing is: https://buffalomedia.net/hosted-sites/nyafp/event/htst/h
It is probably something that I am missing, any help anyone can offer would be great! Thanks.
https://www.ads-software.com/extend/plugins/custom-fields-creator/
- The topic ‘Attachment URL for a PDF Link’ is closed to new replies.