admin_url( 'admin-ajax.php' ), ) ); } add_shortcode('record_audio', 'ar_func_record_audio' ); function ar_func_record_audio(){ ob_start(); ?>
Mic Record:
$fileName, 'post_content' => '', 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'audiorecord', ); // Insert the post into the database $post_id = wp_insert_post( $my_post ); $current_user = wp_get_current_user() ? wp_get_current_user() : 0; update_post_meta($post_id, 'upload_url', $path_array['url']); update_post_meta($post_id, 'upload_path', $uploadDirectory); update_post_meta($post_id, 'course_menber', $current_user->ID); echo 1; } } wp_die(); } add_action( 'init', 'ar_create_post_type_audio_record' ); function ar_create_post_type_audio_record() { register_post_type( 'audiorecord', array( 'labels' => array( 'name' => __( 'Mic Record' ), 'singular_name' => __( 'Mic Record' ) ), 'public' => true, 'has_archive' => true, ) ); } add_action( 'manage_audiorecord_posts_custom_column' , 'ar_custom_columns_record_audio', 10, 2 ); function ar_custom_columns_record_audio( $column, $post_id ) { switch ( $column ) { case 'preview': $post_title = get_the_title($post_id ); $upload_url = get_post_meta($post_id, 'upload_url', true ); ?> user_nicename; $user_email = $user_data->user_email; }else{ $user_record = "Guest"; $user_email = ''; } echo ''. $user_record .''; break; } } add_filter( 'manage_audiorecord_posts_columns', 'ar_set_custom_edit_audiorecord_columns' ); function ar_set_custom_edit_audiorecord_columns($columns) { $columns['preview'] = __( 'Preview', 'your_text_domain' ); $columns['member'] = __( 'Member', 'your_text_domain' ); return $columns; } add_action( 'admin_init', 'ar_codex_admin_init' ); function ar_codex_admin_init() { add_action( 'before_delete_post', 'ar_detele_post_delete_audio_also', 10 ); } function ar_detele_post_delete_audio_also( $pid ) { $path = get_post_meta($pid, 'upload_path', true ); var_dump($path); unlink($path); } ?>