Shortcode for embedding PDFs

If you want to view, directly from a post (article, page), the content of a PDF file without clicking on it, different plugins can be used or, if you want to avoid loading with foreign content, you can make a small shortcode for something like that. An example is given below, entered in the functions.php file (preferably in a child theme):

Thus, to display the contents of a PDF file, you need to write the following code:
[pdf width="" height="850"][/pdf]

Of course, this option can be used to embed in any HTML file, in any way, without involving WordPress if only plays the tag “embed”:

<embed src="" type="application/pdf" style="width:860px; height:700px;min-width:800px;min-height:600px;margin:0 auto;display:block;">

Author: Ovidiu.S

I am quite passionate about this professional area as if I know something - no matter how little - I want to share it with others.

Leave a Reply