• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Tips and Tricks HQ

  • Home
  • Projects
    • All Projects
    • Simple WP Shopping Cart
    • WP Express Checkout Plugin
    • Accept Stripe Payments
    • WP Download Monitor
    • Easy HTTPS Redirection
    • WP Security and Firewall Plugin
    • WP eStore Plugin
    • WP Affiliate Platform
    • WP eMember
  • Products
    • All Products
    • Checkout
  • Support
    • Support Portal
    • Customer Only Forum
    • WP eStore Documentation
    • WP Affiliate Software Documentation
    • WP eMember Documentation
  • Contact

Inserting an Audio Player in Your Theme’s Template File

Home » Blog » Inserting an Audio Player in Your Theme’s Template File

Last updated: July 22, 2014 by Ruhul Amin





I received the following question from a user today:

How can I use the audio player from my WordPress theme’s template file?

This is a quick tutorial for users who want to embed an audio file in their WordPress theme’s template file.

Embed Audio File in a Template File

Step 1. Install the Audio Player Plugin

Grab the audio player plugin from here.



Step 2. Use the PHP Code in Your Template File

Edit your template file and use the following PHP code (where you want to insert the audio player).

<?php
$args = array('fileurl' => 'www.example.com/my-music/mysong.mp3');
echo sc_embed_player_handler($args);
?>

You will need to use the correct URL of the audio file that you want to embed.

You can also pass additional player parameters like the following example:

<?php
$args = array('fileurl' => 'www.example.com/my-music/mysong.mp3', 'autoplay' => 'true', 'loops' => 'true');
echo sc_embed_player_handler($args);
?>

The above code should embed a playable audio file that looks like the following:

wordpress-audio-player-plugin-screenshot

PHP Code for Template 1

Use the following code if you want to use audio player template 1:

<?php
$args = array('fileurl' => 'www.example.com/my-music/mysong.mp3');
echo sc_embed_player_templater1_handler($args);
?>

Alternative Code

You could also use the following PHP code instead of the one shown above:

<?php echo do_shortcode('[sc_embed_player fileurl="www.example.com/my-music/mysong.mp3"]'); ?>

Any shortcodes that you see here can be used in your template file using the above technique.

Related Posts

  • A Brief Introduction to WordPress Nonces
  • How to Use Firebug to Modify Your WordPress Site’s CSS (Video Tutorial)
  • WordPress Action Hooks and Filter Hooks – An Introduction
  • How to Add Meta Boxes to Provide Extra Content for WordPress Posts

Web Development,  Wordpress audio player,  audio player plugin,  WordPress audio player,  wordpress developer tutorial,  WordPress tutorial

Reader Interactions

Leave a Reply

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

Primary Sidebar

Featured & Popular Articles

Video Answers to Top WordPress QuestionsWordPress Optimization Tips and Tricks for Better Performance and SpeedEssential WordPress Security Tips - Is Your Blog Protected?WordPress Simple PayPal Shopping Cart PluginTop 15 Search Engine Optimization (SEO) Techniques I Forget to DoList of the Best and Must Use WordPress PluginsHow do I Start a Blog and Make Money Online?Good Domain Name Picking Tips for Your Blog SetupFind Out Which WordPress Web Hosting Company Offers the Cheapest and Reliable Web Hosting Solution

Featured WordPress Plugins

WP Express Checkout Plugin
wordpress estore plugin
wordpress membership plugin
wordpress affiliate plugin

Recent Posts

  • How to Use Browser Developer Tools to Inspect Elements and [...]
  • Accept Donations via PayPal from Your WordPress Site Easil [...]
  • Buy Now Button Graphics for eCommerce Websites [...]
  • Subscription Button Graphics for eCommerce Websites [...]
  • Adding PayPal Payment Buttons to Your WordPress Sidebar Ea [...]

Comment & Socialize

  • @Rob, We have just released ...
    - admin
  • I installed the plugin a co ...
    - Rob
  • @Sebastian, We've released ...
    - admin
  • I've used this plugin on a ...
    - Sebastian Djupsjöbacka
  • @John, this plugin doesn't ...
    - admin

Check out our solutions

View our WordPress plugin collection and start using them on your site.

Our WordPress Solutions

Footer

Company

  • About
  • Privacy Policy
  • Terms and Conditions
  • Affiliate Login

Top WordPress Plugins

  • Simple Shopping Cart
  • PayPal Donations
  • WP Express Checkout
  • WP eStore
  • WP eMember

Blogging Tips

  • How to Start a Blog
  • Selecting a Good Domain
  • Cheap WP Hosting
  • WP Video Tutorials
  • Simple SEO Tips

Search


Keep In Touch

Copyright © 2025 | Tips and Tricks HQ