How to manage and make media files downloadable in WordPress

In this guide, we will see how make media files in WordPress downloadable.

As you well know, WordPress is no longer a simple platform for blogging, it has now evolved great.

It has long been used to build and maintain corporate websites, portfolios, eCommerce and more.

Given the needs of the various types of websites that can be built, written text may not always be the best way to communicate with those who visit your site.

Podcasts in .mp3 format , videos or e-books could be better suited to the topic you are dealing with and / or the type of audience you are targeting.

Media files are also great resources to offer either for free – for example, when subscribing to the newsletter – or for a fee as a premium product.

Fortunately, WordPress supports a growing number of formats.

Not only that: it allows you to manage all files directly from the media library and make them downloadable without the need to install any plugins.

The management of media files is also a topic addressed in the WordPress video course , the simple and practical course to learn how to use WordPress effortlessly and realize your online business project.

But what formats does WordPress support?

Lots of them: the ones you might find most useful are .jpg, .png, .gif, .pdf, .doc, .ppt, .xls, .mp4, .mov, .mp3 and .wav.

How to manage and make media files downloadable in WordPress

If you want upload a file to your sitein one of the supported formats, just go to your Dashboard, browse the media library and click Add New .

Simply drag the file from the folder on your PC into the window.

If at the time of upload you see the error “The uploaded file exceeds the upload_max_filesize directive in php.ini” , you will simply have to increase the maximum file upload size in WordPress .

That’s all: when the file has been uploaded, you can click on it to view / edit its information (for example: title, description, caption, size, etc.).

Important note!

Each time you upload a file, two URLs are generated:

One related to the attachment page:

  • This is a page on your site which displays the file you just uploaded.

One with the path to the file within the server itself:

  • This is the URL you are interested in: it is in fact the one you will use to ensure that users can download the file.
  • You can find this URL on the page with all the information about the file.
  • You will recognize it because it contains the path wp-content / uploads .

If you try to paste this link into your browser’s navigation bar, a white window will open showing only the file in question.

After this brief introduction, let’s now see how you can integrate media files into your WordPress site

In this guide I will not go into depth on inserting images, as these are files that most users use very often and are rarely offered as a downloadable resource.

If at any time you need support to configure the settings described here, we suggest you try the SOS WP technical support service.

Manage audio files in WordPress

If you have prepared a track .mp3 (or other format) and wish to embed it on your site, proceed as follows.

First, upload the file into the library as explained above with theblock editor: add an Audio block and select the file in the library;

If you use the Classic Editor, click on Add media and click on the file.

By clicking on the .mp3 you want to embed, a window will open on the right with the options related to file view.

Here you can select various options in the Attachment View Settings section :

  • Embed media player inserts a player on the page to play the file directly.
    • This way, users will listen to the audio directly on your site rather than downloading it;
  • Link to media file inserts a link that will open the file in a new tab;
  • Link to attachment page inserts a link to a page with your file inside.

If you enter the player, users can download the file by clicking on Play with the right mouse button and then selecting Save as .

If you enter the link, they will still be able to download it by right-clicking on the link and then clicking Save link as .

Force the download of the audio file

Modern browsers are configured in such a way that downloadable files are also played online whenever possible.

For force file download – rather than playing them in the browser window – you will need to add the following line of code to the .htaccess file:

AddType application / octet-stream .mp3

In the example, all the .mp3 files will be downloaded by clicking on the link, instead of being played with the player and without having to use the right mouse button.

Replace “.mp3” with the file format for which you intend to force the download.

If you have the Yoast SEO plugin installed on your site , you can edit the .htaccess file directly from your Dashboard by navigating to SEO> Tools> Edit File .

Here you will find a text field to edit the .htaccess file.

Obviously, don’t delete lines of code that are already there; just paste the new ones at the end.

If you don’t use Yoast instead, you will find the .htaccess file using the File Manager in your hosting account.

If you use a hosting provider that does not provide you with a File Manager, you will be able to manage files with an FTP account and a tool like FileZilla .

To force the download for other types of files, enter another identical line and replace .mp3 with the extension of the file you are interested in.

The Plugin Compact WP Audio Player

Compact WP Audio Player is a plugin dedicated to .mp3 and .ogg files.

This plugin offers the advantage of reducing the steps required to include audio files in your posts and pages.

It uses a responsive design and works with most browsers and mobile devices.

It also offers file preview functionality (in case you want to sell audio files) and you can use autoplay in such a way that an audio track starts as soon as a page loads.

Manage video files in WordPress

THE video format file they work exactly the same as audios.

When you upload a video, you can decide whether to embed it with the Media Player, or as a downloadable file.

In general, however, I advise you to pay attention to how many videos you upload to your site.

In fact, these are quite large files and loading dozens and dozens of them can weigh down the server and lengthen the loading of web pages.

However, if your content marketing strategy involves sharing a lot of videos, I recommend that you take advantage of the functionality to embed videos found on YouTube and Vimeo in WordPress .

It is important to optimize the videos shared on your site for SEO, so that the search engines index them correctly.

Embedding videos uploaded to these platforms is super easy – just paste the URL into the Text Editor or insert a YouTube block with the block editor.

If you prefer your video to only be available to people who visit your site, you can set the video as Private on YouTube.

In this way, it will only be visible to those who have its link or visit the page where it is embedded, and will not be shown in YouTube search results.

And how to sell videos?

Manage PDF files in WordPress

Unlike audio and video files, WordPress doesn’t have a feature to view PDFs directly within pages and articles.

In this case, the browser itself will open the document for the user in a new window.

By inserting the file using the File block of the block editor, in the block options you will find the possibility to add the Download button.

In this way, by clicking on the button, the user can directly download the file to his computer.

However, if you want the PDF file to be embedded directly into your site, I recommend you try this solution:

  • upload the file to Google Drive and convert it to Google doc format;
  • also make sure to configure your privacy settings so that whoever has the link can only view the file and not modify it;
  • now open the file not as a preview, but in a new window:
    • click on the three dots of the options;
    • select Open in another window ;
  • now click again on the three dots and select Embed element ;
  • copy the code that is generated and paste it into your page.

So, the document will be integrated into your page, within the Google Drive viewer.

The I frame code you entered also includes the width and height values . Edit their values ​​to make the box fit your page.

Using the Google Drive Viewer options, users will also be able to download and print documents.

Conclusion

In this guide we have seen how to embed files of different formats within your WordPress site.

As you can see, these are extremely simple but functional solutions.

Even better: you can do all this without the need to install plugins.

Leave a Reply

Your email address will not be published. Required fields are marked *