Last active
August 29, 2015 14:03
-
-
Save digitalchild/85307b68ff933a4302dd to your computer and use it in GitHub Desktop.
JPlayer code to store via WPUF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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