How to Embed Audio on WordPress Website

If you are looking for a good audio player to give your WordPress blog readers an option of playing music or podcasts, the Compact WP Audio Player plugin is a great choice. A hybrid of flash and HTML5, it can be used to play files that are in either MP3 or OGG format.

That’s right, this also behaves as an OGG player for WordPress! The player is nicely designed, compact, and compatible with all major devices and browsers. It uses a simple shortcode to embed audio files on your posts and pages.

Features

An autoplay option can be used to play audio files as soon as the page or post loads, which you can set up with a help of a simple shortcode. You can specify the OGG and MP3 versions of the file to ensure that the appropriate one is played depending on the user’s device. Browsers such as Firefox, Chrome, Safari and different versions of Internet Explorer are all supported. HTML5 compatibility means that the audio files can be played on iOS devices as well. The compact design of the player makes it so that it doesn’t take up a lot of space on your website and doesn’t affect the loading time.

Possible Uses

The plugin is great for musicians who want to showcase their work through their sites or any webmasters who want to give their visitors an ability to play music in the background while browsing the site. If you sell music through your website, Compact WP Audio Player can be used to give potential buyers a preview of the files available for sale. The plugin can also be extremely useful if you run a podcast on your blog. Simply embed the audio files on your pages or posts and your readers can conveniently listen to your podcasts on any device.

Installation

Follow these standard steps to get it going:

  1. Download the Compact WP Audio Player plugin from WordPress repository. Make sure you save it on your Desktop or elsewhere on your device where you can easily locate the file.
  2. Go to the Plugins menu of your WordPress Dashboard and click Add New.
  3. Choose the Upload tab and browse to find the previously downloaded plugin (called sc_audio_player.zip).
  4. Double click it to upload the file.
  5. Click Install Now and Activate Plugin.

If you’d rather skip the download part, you can go to your Dashboard’s Plugins menu and enter “Compact WP Audio Player” in the search tab. When you find the plugin by Tips and Tricks HQ, click Install Now and Activate Plugin.

Main Shortcodes

To embed an audio file in your post or page, use the following shortcode:

[sc_embed_player fileurl="URL of the MP3 file"]

If you’d like to take advantage of the autoplay feature, simply modify the shortcode to the following:

[sc_embed_player autoplay=true fileurl="URL of the MP3 file"]

You can also specify the volume level for the audio file by adding a value in the range of 0 to 100. Use this shortcode to set the volume to 50 for example:

[sc_embed_player volume="50" fileurl="URL of the MP3 file"]

Using the looping parameter will allow you to reset the playback to the beginning once the file is done playing. To set it up, use this shortcode:

[sc_embed_player loops="true" fileurl="URL of the MP3 file"]

The following shortcode lets you specify both OGG and MP3 file versions for your audio:

[sc_embed_player loops="true" fileurl="URL of the MP3 file|URL of the OGG file"]

With the above shortcode, the plugin will then automatically choose which file to play, depending on the device that is used. Note the “pipe” symbol (|) separating the file paths/URLs for each of the audio files.

Additional Configurations

To embed Compact WP Audio Player directly into your theme, enter the PHP code that comes with the plugin into the template file:

Just modify the shortcode portion of the code above to reflect what it is you are looking to do (i.e. loop the file, provide OGG and MP3 versions, etc.)

Settings Menu

If you need a quick shortcode reminder, go to the SC Audio Player menu item under Settings to see the options. You can also disable simultaneous play in this area if you are hosting multiple audio files on your site, but only want to play one file at a time instead of enabling a continuous playback. This will ensure that the sound automatically stops after the current audio file is done playing.

Leave a Reply

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