Chorality setup: registers CPTs and ACF groups. Placed as a mu-plugin so CPTs/fields are present immediately. */ add_action( 'init', function() { // Register CPT: Articles (Journal) register_post_type('chorality_article', array( 'labels' => array('name' => 'Articles','singular_name' => 'Article'), 'public' => true, 'has_archive' => true, 'show_in_rest' => true, 'supports' => array('title','editor','excerpt','thumbnail','author','revisions'), 'rewrite' => array('slug' => 'journal') )); // Register CPT: Practices register_post_type('chorality_practice', array( 'labels' => array('name' => 'Practices','singular_name' => 'Practice'), 'public' => true, 'has_archive' => true, 'show_in_rest' => true, 'supports' => array('title','editor','excerpt','thumbnail'), 'rewrite' => array('slug' => 'practices') )); // Register CPT: Offerings (workshops/retreats) register_post_type('chorality_offering', array( 'labels' => array('name' => 'Offerings','singular_name' => 'Offering'), 'public' => true, 'has_archive' => true, 'show_in_rest' => true, 'supports' => array('title','editor','excerpt','thumbnail'), 'rewrite' => array('slug' => 'offerings') )); // Register CPT: Lexicon terms register_post_type('chorality_lexicon', array( 'labels' => array('name' => 'Lexicon','singular_name' => 'Term'), 'public' => true, 'has_archive' => false, 'show_in_rest' => true, 'supports' => array('title','editor','excerpt'), 'rewrite' => array('slug' => 'lexicon') )); }, 5 ); /** ACF field groups - register programmatically if ACF is active. Fields: Practice (audio + pdf + difficulty) and Event accessibility note. */ add_action('acf/init', function() { if( function_exists('acf_add_local_field_group') ) { // Practices fields acf_add_local_field_group(array( 'key' => 'group_chorality_practice', 'title' => 'Practice meta', 'fields' => array( array( 'key' => 'field_practice_audio', 'label' => 'Practice audio file', 'name' => 'practice_audio', 'type' => 'file', 'return_format' => 'url', 'mime_types' => 'mp3,wav', ), array( 'key' => 'field_practice_pdf', 'label' => 'Practice sheet (PDF)', 'name' => 'practice_pdf', 'type' => 'file', 'return_format' => 'url', 'mime_types' => 'pdf', ), array( 'key' => 'field_practice_difficulty', 'label' => 'Difficulty', 'name' => 'practice_difficulty', 'type' => 'select', 'choices' => array('Beginner'=>'Beginner','Intermediate'=>'Intermediate','Advanced'=>'Advanced'), ), ), 'location' => array( array(array( 'param' => 'post_type', 'operator' => '==', 'value' => 'chorality_practice', )), ), )); // Event accessibility notes (The Events Calendar posts are 'tribe_events') acf_add_local_field_group(array( 'key' => 'group_chorality_event', 'title' => 'Event meta', 'fields' => array( array( 'key' => 'field_event_accessibility', 'label' => 'Accessibility notes', 'name' => 'event_accessibility', 'type' => 'textarea' ), ), 'location' => array( array(array( 'param' => 'post_type', 'operator' => '==', 'value' => 'tribe_events', )), ), )); } }); PHP