'bcal_aliases', 'label' => __( 'Aliases', 'bearius-calendar' ), 'type' => 'textarea', 'help' => __( 'Other names used in import files, one per line or comma separated. Imports matching an alias are assigned to this term instead of creating a duplicate.', 'bearius-calendar' ), ); return array( 'bcal_venue' => array( array( 'key' => 'bcal_address', 'label' => __( 'Street address', 'bearius-calendar' ), 'type' => 'text', 'help' => '', ), array( 'key' => 'bcal_postal', 'label' => __( 'Postal code', 'bearius-calendar' ), 'type' => 'text', 'help' => '', ), array( 'key' => 'bcal_city_id', 'label' => __( 'City', 'bearius-calendar' ), 'type' => 'city', 'help' => __( 'Events at this venue without a city get this one.', 'bearius-calendar' ), ), array( 'key' => 'bcal_lat', 'label' => __( 'Latitude', 'bearius-calendar' ), 'type' => 'text', 'help' => __( 'Optional. Makes directions links exact. Copy it from any map app.', 'bearius-calendar' ), ), array( 'key' => 'bcal_lng', 'label' => __( 'Longitude', 'bearius-calendar' ), 'type' => 'text', 'help' => '', ), $aliases, ), 'bcal_organizer' => array( array( 'key' => 'bcal_url', 'label' => __( 'Website', 'bearius-calendar' ), 'type' => 'url', 'help' => '', ), $aliases, ), 'bcal_city' => array( $aliases ), 'bcal_category' => array( array( 'key' => 'bcal_color', 'label' => __( 'Colour', 'bearius-calendar' ), 'type' => 'color', 'help' => __( 'Marks this category in the calendar views. Subcategories without their own colour use this one.', 'bearius-calendar' ), ), $aliases, ), ); } /** * Hooks for every taxonomy. */ function bcal_register_term_field_hooks() { foreach ( array_keys( bcal_term_fields() ) as $taxonomy ) { add_action( $taxonomy . '_add_form_fields', 'bcal_term_add_fields' ); add_action( $taxonomy . '_edit_form_fields', 'bcal_term_edit_fields', 10, 2 ); add_action( 'created_' . $taxonomy, 'bcal_term_save_fields' ); add_action( 'edited_' . $taxonomy, 'bcal_term_save_fields' ); } } add_action( 'admin_init', 'bcal_register_term_field_hooks' ); /** * Input markup. * * @param array $field Field. * @param string $value Value. * @return string */ function bcal_term_input( $field, $value ) { $id = 'bcal-term-' . $field['key']; if ( 'color' === $field['type'] ) { $hex = bcal_normalize_hex( (string) $value ); return ' '; } if ( 'city' === $field['type'] ) { $cities = get_terms( array( 'taxonomy' => 'bcal_city', 'hide_empty' => false, 'number' => 1000, 'orderby' => 'name', ) ); $html = ''; } if ( 'textarea' === $field['type'] ) { return ''; } return ''; } /** * "Add term" screen. * * @param string $taxonomy Taxonomy. */ function bcal_term_add_fields( $taxonomy ) { $fields = bcal_term_fields(); wp_nonce_field( 'bcal_term', 'bcal_term_nonce' ); foreach ( $fields[ $taxonomy ] as $field ) { echo '
' . esc_html( $field['help'] ) . '
'; } echo '' . esc_html( $field['help'] ) . '
'; } echo '