settings = apply_filters('acps/get_settings', 'all'); //Run page validator function check if( $this->validate_page() === true ) { //Add custom scripts wp_enqueue_script(array( 'acps-admin-ajax', 'acps-chzn-scripts' )); //Localise ajax scripts wp_localize_script('acps-admin-ajax', 'acps_vars', array( 'acps_nonce' => wp_create_nonce('acps-nonce') ) ); //Add custom styles wp_enqueue_style(array( 'acps-admin-styles', 'acps-chzn-styles' )); } } //Admin_head function function admin_head() { //Run page validator function check if( $this->validate_page() === true ) { //Global $post variable for ajax variable global $post; //Add variable for ajax request echo ''; } //Add metaboxes add_meta_box('acps_fields', __("Form Settings",'acps'), array($this, 'acps_fields_box_html'), 'acps', 'normal', 'high'); } //Html fields function acps_fields_box_html( $post ) { //Include metabox file(s) include( $this->settings['path'] . 'core/metaboxes/meta_box_form.php' ); } //Validate post page function validate_page() { //Grab WordPress global variables 'pagenow' and 'typenow' global $pagenow, $typenow; //Check if page is post new page if(in_array( $pagenow, array('post.php', 'post-new.php') ) ) { //Check if on acps post type if($typenow=='acps') { return true; } } } //Save post function (saves post data) function acps_meta_save( $post_id ) { //If the post isn't acps, don't run these scripts if(isset($_POST['post_type']) != "acps") { return; } //Checks save status $is_autosave = wp_is_post_autosave( $post_id ); $is_revision = wp_is_post_revision( $post_id ); $is_valid_nonce = ( isset( $_POST[ 'example_nonce' ] ) && wp_verify_nonce( $_POST[ 'example_nonce' ], basename( __FILE__ ) ) ) ? 'true' : 'false'; //Exits script depending on save status if ( $is_autosave || $is_revision || !$is_valid_nonce ) { return; } //Checks for post type and saves if needed if( isset( $_POST[ 'acps_post_type' ] ) ) { update_post_meta( $post_id, 'acps_post_type', $_POST[ 'acps_post_type' ] ); } else { delete_post_meta( $post_id, 'acps_post_type' ); } //Checks for taxonomy values and saves if needed if( isset( $_POST[ 'acps_taxonomy_values' ] ) ) { update_post_meta( $post_id, 'acps_taxonomy_values', $_POST[ 'acps_taxonomy_values' ] ); } else { delete_post_meta( $post_id, 'acps_taxonomy_values' ); } //Checks for form title and saves if needed if( isset( $_POST[ 'acps_form_title' ] ) ) { update_post_meta( $post_id, 'acps_form_title', $_POST[ 'acps_form_title' ] ); } //Checks for tile position value and saves if needed if( isset( $_POST[ 'acps_title_position' ] ) ) { update_post_meta( $post_id, 'acps_title_position', $_POST[ 'acps_title_position' ] ); } //Checks for container class and saves if needed if( isset( $_POST[ 'acps_form_container_class' ] ) ) { update_post_meta( $post_id, 'acps_form_container_class', $_POST[ 'acps_form_container_class' ] ); } //Checks for label settings and saves if needed if( isset( $_POST[ 'acps_form_labels' ] ) ) { update_post_meta( $post_id, 'acps_form_labels', $_POST[ 'acps_form_labels' ] ); } else { delete_post_meta($post_id, 'acps_form_labels'); } //Checks for keyword label text exists and saves if needed if( isset( $_POST[ 'acps_keyword_text' ] ) ) { update_post_meta( $post_id, 'acps_keyword_text', $_POST[ 'acps_keyword_text' ] ); } //Checks for label text fields and saves if needed if( isset( $_POST[ 'acps_label_text' ] ) ) { update_post_meta( $post_id, 'acps_label_text', $_POST[ 'acps_label_text' ] ); } //Checks for label text fields and saves if needed if( isset( $_POST[ 'acps_submit_button_text' ] ) ) { update_post_meta( $post_id, 'acps_submit_button_text', $_POST[ 'acps_submit_button_text' ] ); } //Checks for text field option exists and saves if needed if( isset( $_POST[ 'acps_keyword_input' ] ) ) { update_post_meta( $post_id, 'acps_keyword_input', $_POST[ 'acps_keyword_input' ] ); } else { delete_post_meta($post_id, 'acps_keyword_input'); } //Checks for keyword form value and saves if needed if( isset( $_POST[ 'acps_keyword_form_value' ] ) ) { update_post_meta( $post_id, 'acps_keyword_form_value', $_POST[ 'acps_keyword_form_value' ] ); } //Checks for blank term settings and saves if needed if( isset( $_POST[ 'acps_blank_term' ] ) ) { update_post_meta( $post_id, 'acps_blank_term', $_POST[ 'acps_blank_term' ] ); } else { delete_post_meta($post_id, 'acps_blank_term'); } //Checks for keyword form value and saves if needed if( isset( $_POST[ 'acps_multiple_terms' ] ) ) { update_post_meta($post_id, 'acps_multiple_terms', $_POST[ 'acps_multiple_terms' ] ); } else { delete_post_meta($post_id, 'acps_multiple_terms'); } } //Find taxonomies ajax function function acps_process_taxonomy_ajax() { //Check nonce if( !isset( $_POST['acps_post_type_nonce'] ) || !wp_verify_nonce($_POST['acps_post_type_nonce'], 'acps-nonce') ) die('Permissions check failed'); //Get taxonomies as an object $taxonomy_objects = get_object_taxonomies( $_POST['acps_post_type'], 'objects' ); //Check taxonomies exist if(sizeof($taxonomy_objects)<1) { die('
No Taxonomies Found