How To Download WordPress Audio Attachments

Some people like to stream audio in the browser, others like to download. Each of them is able set up the browser to choose between downloading or streaming different MIME types to get what they need. On the other hand you can force download of certain MIME type files using PHP header() function. See How … Read more

Problem adding MP3 attachments to a jPlayer playlist

Have a look at wp_localize_script for passing php data to javascript. A pseudo-code example: $tracks = array(); foreach( $mp3_attachments as $mp3_attachment ): $tracks[] = array( ‘mp3’ => $mp3_attachment[‘filename’], ‘title’ => $mp3_attachment[‘title’] ); endforeach; $wpa_track_data = array( ‘tracks’ => $tracks ); wp_enqueue_script( ‘wpa_script’, get_template_directory_uri() . ‘/js/yourscript.js’ ); wp_localize_script( ‘wpa_script’, ‘wpa_data’, $wpa_track_data ); Then in your js … Read more

Audio post format with Advanced Custom Fields

Advanced Custom Field plugin uses get_field() to retrieve values. Your code should be something like: $audio = get_field(‘audio_post_format_url’, $post->ID); var_dump( $audio ); # To make sure you’re retrieving the right value echo wp_oembed_get( $audio ); Note that get_field() does not need a second parameter, it will take the current post ID if omitted. If var_dump( … Read more

How to add data attributes to the wordpress audio shortcode

They’re may be a more parsimonious way to achieve what you want, maybe with jQuery or a more heavily customized version of the code, but just keeping to WordPress core functions, you could try the following approach, which utilizes the wp_audio_shortcode_override filter. I tested a version of the below using is_page() for the main conditional. … Read more

Add audio attachment link to RSS

You can add this part into your function: $audios =& get_children(‘post_type=attachment&post_parent=”.$post->ID.”&post_mime_type=audio’ ); foreach ( $audios as $id => $audio ){ $content.='<a href=”‘.wp_get_attachment_url($id).'” target=”_blank”>’.$audio->post_title.'</a> ‘; } to add audio links into your feed content. I’m using get_children() here, you can read more about it here: http://codex.wordpress.org/Function_Reference/get_children Edit: Here is the whole function: function featuredtoRSS($content) { global … Read more

Displaying audio player as preview in audio post in WP3.6

You missed the src part. It should have been: Go on the Shortcode section of the Audio / Video support in Core post. $post_content=”lorem ipsum dolor lorem ipsum “; if( preg_match( ‘#\#s’, $post_content, $matches ) && preg_match(“https://wordpress.stackexchange.com/”([^”]+)”https://wordpress.stackexchange.com/”, $matches[0], $m) ){ echo $m[1]; // echoes http://wpthemetestdata.files.wordpress.com/2008/06/originaldixielandjazzbandwithalbernard-stlouisblues.mp3 //set as featured } The first regex will get your … Read more

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