0240 > Populate Booth ID Array

add_filter(‘acf/load_field/name=booth_id’, ‘populate_booth_id_array’, 20, 1); function populate_booth_id_array($field) { global $post; if (!$post instanceof WP_Post || !is_admin()) return $field; $s_id = null; if (get_post_type($post->ID) == ‘show’) { $s_id = $post->ID; } elseif (get_post_type($post->ID) == ‘application’) { $s_id = get_field(‘show_relationship’, $post->ID)[0]; } else…Continue reading

MFP > Populate Booth ID Array

add_filter(‘acf/load_field/name=booth_id’, ‘populate_booth_id_array’, 20, 1); function populate_booth_id_array($field) { global $post; if (!$post instanceof WP_Post || !is_admin()) return $field; $s_id = null; if (get_post_type($post->ID) == ‘show’) { $s_id = $post->ID; } elseif (get_post_type($post->ID) == ‘application’) { $s_id = get_field(‘show_relationship’, $post->ID)[0]; } else…Continue reading

MFP > Populate Booth ID Array

add_filter(‘acf/load_field/name=booth_id’, ‘populate_booth_id_array’, 20); function populate_booth_id_array($field) { global $post; if (!$post instanceof WP_Post || !is_admin()) return $field; $s_id = null; if (get_post_type($post->ID) == ‘show’) { $s_id = $post->ID; } elseif (get_post_type($post->ID) == ‘application’) { $s_id = get_field(‘show_relationship’, $post->ID)[0]; } else {…Continue reading

0270 > Get IDs from SVG

function get_booth_ids_from_svg($s_id) { $svgData = get_field(‘svg_floorplan_file’, $s_id); $dom = new DOMDocument(); $html = ‘ ‘; $result = ‘ The data included in this document is from www.openstreetmap.org. The data is made available under ODbL. ‘; $doc = new DOMDocument; $doc->loadXML($result);…Continue reading

Copy All Post Meta to New Post

add_action( ‘save_post_show’, ‘save_post_show_default’, 1, 3); function save_post_show_default( $post_id, $post, $update ) { if( is_a( $post, ‘\WP_Post’ ) && ‘auto-draft’ == $post->post_status && post_type_supports( $post->post_type, ‘custom-fields’ ) && ‘0000-00-00 00:00:00’ == $post->post_date_gmt && $post_id > 0 && ! $update ) {…Continue reading

MFP > ACF Google API Key

add_action(‘acf/init’, ‘acf_init_google_api_key’); function acf_init_google_api_key() { acf_update_setting(‘google_api_key’, ‘AIzaSyAN_UuSnJqi4C4cinccmoHtK619hGptrbc’); }Continue reading

MFP > Deploy Show & Get Data

add_action(‘acf/save_post’, ‘add_show_children’); function add_show_children($post_id) { if (defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) return $post_id; if (!wp_is_post_revision($post_id) && ‘show’ == get_post_type($post_id) && ‘auto-draft’ != get_post_status($post_id) && ‘draft’ == get_post_status($post_id) ) { if (0 == get_post($post_id)->post_parent) { $countInt = (int) 1; $count = (string) $countInt;…Continue reading

MFP > Deploy Show & Get Data

add_action(‘acf/save_post’, ‘add_show_children’); function add_show_children($post_id) { if (defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) return $post_id; if (!wp_is_post_revision($post_id) && ‘show’ == get_post_type($post_id) && ‘auto-draft’ != get_post_status($post_id) && ‘draft’ == get_post_status($post_id) ) { if (0 == get_post($post_id)->post_parent) { $countInt = (int) 1; $count = (string) $countInt;…Continue reading

MFP > Deploy Show & Get Data

add_action(‘acf/save_post’, ‘add_show_children’); function add_show_children($post_id) { if (defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) return $post_id; if (!wp_is_post_revision($post_id) && ‘show’ == get_post_type($post_id) && ‘auto-draft’ != get_post_status($post_id) && ‘draft’ == get_post_status($post_id) ) { if (0 == get_post($post_id)->post_parent) { $countInt = (int) 1; $count = (string) $countInt;…Continue reading

ACF Do Shortcode Filter

add_filter(‘acf/format_value/type=text’, ‘acf_do_shortcode’, 10, 3); add_filter(‘acf/format_value/type=textarea’, ‘acf_do_shortcode’, 10, 3); function acf_do_shortcode($value, $post_id, $field) { if (is_admin()) { return $value; } return apply_filters(‘the_content’, $value); }Continue reading