function action_save_post_page($post_id, $post, $update) { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } if (!current_user_can('edit_page', $post_id)) { return $post_id; } add_all_parent_terms('location-type', $post_id); if ($update && isset($_POST['uw_location_refresh_nonce']) && wp_verify_nonce($_POST['uw_location_refresh_nonce'], 'uw_location_refresh_action') && isset($_POST['uw_location_refresh'])) { switch ($_POST['uw_location_refresh']) { case 'pages': get_location_pages(false, true); break; case 'data': get_location_data($post_id, true); break; case 'assets': get_location_assets($post_id, true); break; case 'attributes': get_location_attributes($post_id, true); break; } } }
function shortcode_attributes() { global $post; get_location_attributes(); $post_terms = wp_get_object_terms($post->ID, 'location-attributes', array('fields' => 'ids')); $location_attribute_meta = get_post_meta($post->ID, 'uw-location-attributes', true); $walker = new Walker_Location_Attribute($location_attribute_meta); return '<ul class="location-attributes">' . wp_list_categories(array('echo' => false, 'taxonomy' => 'location-attributes', 'title_li' => '', 'include' => $post_terms, 'walker' => $walker)) . '</ul>'; }