Skip to content

Instantly share code, notes, and snippets.

@digitalchild
Last active August 29, 2015 14:03
Show Gist options
  • Save digitalchild/85307b68ff933a4302dd to your computer and use it in GitHub Desktop.
Save digitalchild/85307b68ff933a4302dd to your computer and use it in GitHub Desktop.
JPlayer code to store via WPUF
function jplayer_custom_field ( $post_id ) {
$title = $_POST['jplayer_title'];
# get the files media id
$file_id = get_post_meta( $post_id, 'jplayer_file', true );
# create the path for upload
$file_path = wp_get_attachment_url( $file_id ) ;
$jplayer_data[] = array( 'title' => $title, 'path' => $file_path );
update_post_meta( $post_id, '_jplayer_sample_file', $jplayer_data );
}
# save the data after the first insert
add_action( 'wpuf_add_post_after_insert', 'jplayer_custom_field' );
# update the data on edit.
add_action( 'wpuf_edit_post_after_update', 'jplayer_custom_field' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment