Description
Register the oik-track Custom Post TypeMost of the information we can determine from a track can be dynamically obtained at run-time using the getid3 PHP library BUT we need to store some of it for when the actual file is NOT available on the server So the fields we need are: _oikt_recording – reference to the actual recording _oikt_track – the track number – for sorting – rather than using menu_order _oikt_duration – the length of the track in mm:ss _oikt_composer – the composers – separated by ;
Usage
oik_tunes_register_track();Parameters
Returns
voidSource
File name: oik-tunes/oik-tunes.phpLines:
1 to 21 of 21
function oik_tunes_register_track() { $post_type = 'oik-track'; $post_type_args = array(); $post_type_args['label'] = 'Tracks'; $post_type_args['description'] = 'Track'; $post_type_args['show_in_rest'] = true; bw_register_post_type( $post_type, $post_type_args ); bw_register_field( "_oikt_recording", "noderef", "Recording", array( '#type' => "oik-recording", '#optional' => true ) ); bw_register_field( "_oikt_track", "numeric", "Track number e.g. 1" ); bw_register_field( "_oikt_duration", "text", "Duration (mm:ss)" ); bw_register_field( "_oikt_composer", "text", "Composer(s)" ); bw_register_field( "_oikt_UFI", "text", "Unique File Identifier - possibly a unique key" ); bw_register_field_for_object_type( "_oikt_recording", $post_type ); bw_register_field_for_object_type( "_oikt_track", $post_type ); bw_register_field_for_object_type( "_oikt_duration", $post_type ); bw_register_field_for_object_type( "_oikt_composer", $post_type ); bw_register_field_for_object_type( "_oikt_UFI", $post_type ); add_filter( "manage_edit-{$post_type}_columns", "oik_tunes_oik_track_columns", 10, 2 ); add_action( "manage_{$post_type}_posts_custom_column", "bw_custom_column_admin", 10, 2 ); }View on GitHub
Invoked by
Calls
Call hooks
API Letters:
