Hard-coded Audio Player

I would recommend that you have your theme require the wordpress.org version of the wpaudioplayer plugin. There is a great article about having themes check for and require plugins. As is well-argued on this WPSE answer, it’s not a great idea to take code from a plugin and include it in your theme because you … Read more

How to add audio files to wordpress blog and making it auto play?

Basic parts To get all audio files attached to a post use get_children(): $audio_files = get_children( array ( ‘post_parent’ => get_the_ID(), ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘audio’ ) ); For the last attached file URL use wp_get_attachment_url() and pass the ID of the last child as an argument: $id = array_pop( array_keys( … Read more

How to get the ID of an item in an audio playlist?

We don’t have an explicit filter for the data array so here are two workarounds that you might give a try: Approach #1 – As meta data We can add attachment_id to the meta data for each playlist item, via the wp_get_attachment_metadata filter, but first we have to register it via the wp_get_attachment_id3_keys filter. Here’s … Read more

WP REST – video and audio players

Ran into this same issue and I found the answer after many hours and almost giving up. It’s in a bit of code that written to make the Customizer work with playlists. Checkout this comment from /wp-includes/widgets/class-wp-widget-text.php: /** * Enqueue preview scripts. * * These scripts normally are enqueued just-in-time when a playlist shortcode is … Read more

Using audio shortcode for .mp3 URLs with a query string

The problem: The problem seems to be that wp_check_filetype() doesn’t recognize mp3 files with GET parameters. Possible workarounds: You have two options as far as I can see: 1) Override the audio shortcode with the wp_audio_shortcode_override filter. 2) or allow any audio extensions via the wp_audio_extensions filter. Here’s an example how you can implement the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)