I have a blog which I sometimes use for audio clips. I want to put an Audio Player on the frontpage of my blog.
How can I put the player after the title or make its code part of post excerpts?
I have a blog which I sometimes use for audio clips. I want to put an Audio Player on the frontpage of my blog.
How can I put the player after the title or make its code part of post excerpts?
You must be logged in to post a comment.
Plugin option
When searching for a plugin, it is important to check:
Do it yourself
You are in control of what happens and when it happens.
Here I’m creating a function that will print a Html5 Audio Tag based on two audio files uploaded to any post or page -one
mp3
and oneogg
.In the theme template files (
single.php
,page.php
, etc), put the functionprint_audio_attachments_as_html5
like this:Note that the function is placed inside The Loop, so
$post->ID
is available.Put the following function at the end of your theme functions file
/wp-content/themes/your-theme/functions.php
check the comments in the code
Related Q&A
Useful info
If you’re on WordPress.com, you have the [audio URL] shortcode at your disposal.
If you’re on WordPress.org, you can install the Jetpack plugin to get that shortcode. The shortcode figures out whether your browser supports flash or html5, and chooses the appropriate player.
There’s an alternative plugin called “Shortpack” which just gives you the Jetpack shortcodes if you don’t want the other Jetpack features.
you can use a free plugin Audio Player from the plugin repository.