onway
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
I made it, but not sure if it is the best way. I placed the category dropdown in events-manager/forms/location-editor.php just like in categories-public.php
Then I made AJAX post to save categories when selected.<script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#loc-categoryselect').blur(function(){ var cats = jQuery(this).val(); jQuery.ajax({ type: "POST", url: "<?php echo get_template_directory_uri()?>/plugins/events-manager/forms/location/ajax-save-cats.php", data: { categories: cats, current_location: <?php echo $EM_Location->post_id;?> }, success: function (isError) { //show little green tick if (!isError){ jQuery('#loc-cat-title').fadeIn('slow').fadeOut(5000); } } }); }); }); </script>
The ajax-save-cats.php file use wp_set_object_terms to save the categories.
if (isset($_POST["categories"]) && !empty($_POST["categories"])) { $cat_ids = $_POST["categories"]; $cat_ids = array_map( "intval", $cat_ids ); $cat_ids = array_unique( $cat_ids ); $term_taxonomy_ids = wp_set_object_terms( $current_location_id, $cat_ids, "location_category"); header( "Content-Type: application/json" ); echo json_encode(is_wp_error( $term_taxonomy_ids )); }
Forum: Plugins
In reply to: [Frontend Edit Profile] Text domain not workingI hope it will be fixed in the next update. ??
Forum: Everything else WordPress
In reply to: Interest Level in Web to Print plugin for WPIm interested in too. How can I Contact you
Viewing 3 replies - 1 through 3 (of 3 total)