function attachment($attachment)
{
    if (is_pdf($attachment)) {
        add_attachment($attachment);
    }
    return $attachment;
}
Example #2
0
</h1>
          <div><a href="<?php 
    echo wp_get_attachment_url(get_the_ID());
    ?>
" title="<?php 
    the_title();
    ?>
" target="_blank">Download</a></div>
					<?php 
    the_excerpt();
    ?>
				</div><!-- .entry-content -->

				<footer class="entry-meta">
          <iframe class="uw-pdf-view" style="<?php 
    echo is_pdf() ? 'width:100%;height:900px;' : 'width:0px;height:0px;';
    ?>
" src="<?php 
    echo wp_get_attachment_url(get_the_ID());
    ?>
?<?php 
    echo time();
    ?>
"></iframe>
					<?php 
    edit_post_link(__('Edit', 'twentyeleven'), '<span class="edit-link">', '</span>');
    ?>
				</footer><!-- .entry-meta -->
			</article><!-- #post-<?php 
    the_ID();
    ?>