Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Pull PDF links from posts for category pages
- function pdf_links() {
- global $wpdb;
- $attachment_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1");
- $attachment_url = wp_get_attachment_link($attachment_id);
- if($attachment_id == NULL){
- echo '';
- } else {
- echo wp_get_attachment_link($attachment_id, '' , false, false, 'Download PDF');
- echo $attachment_url;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement