Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // Show attachments for the current post
- $args = array(
- 'post_type' => 'attachment',
- 'numberposts' => -1,
- 'post_status' => null,
- 'post_mime_type' => 'application/pdf',
- 'post_parent' => $post->ID
- );
- $attachments = get_posts($args);
- if ($attachments) {
- foreach ( $attachments as $attachment ) {
- // build embed link
- $embed_link = 'http://docs.google.com/viewer?url=' . wp_get_attachment_url( $attachment->ID ) . '&embedded=true';
- // thumbnail
- $output = '<a href="' . $embed_link . '" class="fancybox-iframe fancybox" id="fancybox-auto">';
- $output .= get_the_post_thumbnail( $post->ID, 'large' );
- $output .= '</a>';
- // print
- echo $output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement