validate_page() ) { return; } // vars $screen = get_current_screen(); $taxonomy = $screen->taxonomy; // load acf scripts acf_enqueue_scripts(); // actions add_action('admin_footer', array($this, 'admin_footer'), 10, 1); add_action("{$taxonomy}_add_form_fields", array($this, 'add_term'), 10, 1); add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 10, 2); } /* * add_term * * description * * @type function * @date 8/10/13 * @since 5.0.0 * * @param $post_id (int) * @return $post_id (int) */ function add_term( $taxonomy ) { // vars $post_id = acf_get_term_post_id( $taxonomy, 0 ); // update vars $this->view = 'add'; // get field groups $field_groups = acf_get_field_groups(array( 'taxonomy' => $taxonomy )); // render if( !empty($field_groups) ) { // data acf_form_data(array( 'screen' => 'taxonomy', 'post_id' => $post_id, )); // wrap echo '
'; // loop foreach( $field_groups as $field_group ) { $fields = acf_get_fields( $field_group ); acf_render_fields( $fields, $post_id, 'div', 'field' ); } // wrap echo '
'; } } /* * edit_term * * description * * @type function * @date 8/10/13 * @since 5.0.0 * * @param $post_id (int) * @return $post_id (int) */ function edit_term( $term, $taxonomy ) { // vars $post_id = acf_get_term_post_id( $term->taxonomy, $term->term_id ); // update vars $this->view = 'edit'; // get field groups $field_groups = acf_get_field_groups(array( 'taxonomy' => $taxonomy )); // render if( !empty($field_groups) ) { acf_form_data(array( 'screen' => 'taxonomy', 'post_id' => $post_id, )); foreach( $field_groups as $field_group ) { // title if( $field_group['style'] == 'default' ) { echo '

' . $field_group['title'] . '

'; } // fields echo ''; $fields = acf_get_fields( $field_group ); acf_render_fields( $fields, $post_id, 'tr', 'field' ); echo '
'; } } } /* * admin_footer * * description * * @type function * @date 27/03/2015 * @since 5.1.5 * * @param $post_id (int) * @return $post_id (int) */ function admin_footer() { ?> query($wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s", $search, $_search )); } } new acf_form_taxonomy(); endif; ?>