How to Add a PDF File to a WordPress Post

Опубликовано: 29 Октябрь 2024
на канале: InMotion Hosting
25,656
171

WordPress allows you to add documents of all types into their posts, but one of the most universal file types that can be used is the PDF (portable document format). PDF files allow you develop content on multiple platforms then display them through a browser or reader application on different types of devices. We will be demonstrating how to embed a PDF into a WordPress post and show the difference when using a plugin like the Google Doc Embedder.


Before you start, make sure that you have a few PDF files saved into your Media Library. If you have already loaded the Google Doc Embedder plugin, then deactivate it for the first part of the tutorial (Embedding a PDF into a WordPress post Without Using a Plugin)


There is a difference in embedding with a plugin like the Google Doc embedder and using the default WordPress option to embed a PDF. The default behavior without the plugin simply adds a link in the post going to the PDF file. In order for a viewer to see the PDF, they must click on the link. Using the Google Doc embedder, you see the actual file immediately without having to click on the link. The plugin provides a framework where the document is immediately seen without clicking on a link.


Embedding a PDF into a WordPress Post Without Using a Plugin

Login to the WordPress Administrator.
Click on Posts.
Click on Add New (or Edit existing post).
Click on Add Media.
Make sure that you are on the Visual tab. Upload the PDF if necessary.
Click on the PDF file that you want to add.
In the bottom right corner, click on Insert into Post.
Click on Update (or Publish for new post).

You can then click to Preview Changes in the top right corner, or view site and go to the post if it is published. Notice that WordPress creates a text link of the PDF that was embedded. There is no graphical representation of the PDF.


Embeding a PDF into a WordPress Post using the Google Doc Embedder Plugin

*If you have deactivated the Google doc embedder plugin, make sure to make it active for this part of the tutorial. If you have not loaded it yet, please add this plugin into your site. You can find it here: https://wordpress.org/plugins/google-....

Note that there are different plugins that can do the same thing, we have no preference for the plugin that you wish to use.

Login to the WordPress Administrator.
Click on Posts.
Click on Add New (or Edit existing post).
Click on Add Media.
Make sure that you are on the Visual tab. Upload the PDF if necessary.
Click on the PDF file that you want to add.
In the bottom right corner, click on Insert into Post.
Click on Update (or Publish for new post).

At this point, if you look at the post, you will see that there is shortcode inserted into your post that begins with "[gview file=". This is placed there by the plugin. Click on Preview Changes or go to the post to see the post where you have added the PDF. When you see the post, you will see a graphic that represents the PDF file in place of a link when used without the plugin. This may be preferable to you depending on how you want to show the PDF file.

InMotion Hosting was founded in 2001 and provides personal and business web hosting for everyone! For more information about InMotion Hosting and the services we provide see here:

https://www.inmotionhosting.com/wordp...