WordPress – How to open PDF in a lightbox

Product:

WonderPlugin Lightbox

Tutorial:

This tutorial will show you how to open a PDF file in a lightbox using the plugin WonderPlugin Lightbox.

Step 1: In your WordPress post or page, create a text or image link that links to your PDF file, then in the text editor, switch to the Text mode.

Step 2: Add class="wplightbox" to the <a> tag. You can also add data tag data-width, data-height to specify the maximum size of the lightbox.

Here is an example:

Open PDF in a lightbox popup

The code of the above example is as following:

<a class="wplightbox" data-width=1200 data-height=1200 href="https://www.wonderplugin.com/wp-content/uploads/2017/02/how-to-create-a-wordpress-post-carousel.pdf">Open PDF in a lightbox popup</a>