jQuery autocomplete: retrieving term slug when term name selected

Here is my solution: 1.HTML: I defined two fields for each taxonomy, one visible for the selection/autocompletion of the term label; the second one, hidden, for receiving the corresponding value (term slug). For a typical category, it looks like: <input id=”collection” type=”text” placeholder=”Collection”> <input id=”collection-value” class=”hidden-field” name=”1-collection”> 2.Javascript: the default events focus and select have … Read more

How to load jquery ui autocomplete combobox?

Try to load the script in the footer section. <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js”></script> <script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js”></script> <script type=”text/javascript”> $(document).ready(function(){ $(“#clientAutocomplete”).autocomplete({ source:’client_autocomplete.php’, minLength:1 }); }); </script> This worked for me

Convert Custom Post Data to Javascript Array for Autocomplete

$args = array( ‘post_type’ => ‘promo’ ); $loop = new WP_Query( $args ); $promos = array(); while ( $loop->have_posts() ) : $loop->the_post(); foreach((get_the_category()) as $category); $promos[] = $category->cat_name. ‘ – ‘ .get_the_title(); endwhile; echo ‘<script> jQuery(document).ready(function($) { var promoList=”.json_encode($promos) .”; $( “#auto-promo” ).autocomplete({ source: promoList }); }); </script>’;