WordPress autocomplete search with taxonomies

Ok I got it! That’s the code for my search-results.php <?php include(‘../../../wp-load.php’); $term=$_GET[“term”]; $json=array(); $terms = get_terms( ‘produits’ ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term ) { $json[]=array( ‘value’=> $term->name ); } } echo json_encode($json); ?> Thanks milo for your help ! I needed … Read more

How do I make multiple dependent input fields that use the jquery autocomplete function?

Add a autocomplete ‘select’ catch to your first autocomplete field. Use this to get the chosen value from the autocomplete. Use an Ajax call to obtain your next autocomplete source based on the selected value and apply the new source to the next autocomplete field. jQuery( “#cns-make” ).autocomplete({ source: availableTags, select: function (event, ui) { … Read more

buddypress remove username from autocomplete

Try this but note that it may not send the message: ‘<span id=”%s” href=”#”></span><img src=”%s” style=”width: 15px”> %s %s’ . “\n”, esc_attr( ‘link-‘ . $user->ID ), esc_url( $user->image ), esc_html( $user->name ), ‘ ‘ Or this: ‘<span id=”%s” href=”#”></span><img src=”%s” style=”width: 15px”> %s’ . “\n”, esc_attr( ‘link-‘ . $user->ID ), esc_url( $user->image ), esc_html( $user->name … Read more

Maps search box autocomplete with callback JS function?

Try this in your js file: function robbte_map_initialize() { var input = document.getElementById(‘searchTextField’); var autocomplete = new google.maps.places.Autocomplete(input); google.maps.event.addListener(autocomplete, ‘place_changed’, function () { var place = autocomplete.getPlace(); if (!place.geometry) { window.alert(“Select a suggestion from the list”); return; } document.getElementById(‘city2’).value = place.name; document.getElementById(‘cityLat’).value = place.geometry.location.lat(); document.getElementById(‘cityLng’).value = place.geometry.location.lng(); }); } jQuery(document).ready (robbte_map_initialize);

custom autocomplete search

I found my problem. It was just a problem from my search php script! Without trim( $_REQUEST[‘term’] ) it will not correctly filter results. Now like this it works perfectly: function search_autocomplete(){ $posts = get_posts( array( ‘s’ => trim( $_REQUEST[‘term’] ), ‘post_type’ => array(‘post’, ‘portfolio’) ) ); $suggestions=array(); global $post; $args = array(‘post_type’ => array(‘post’, … Read more

Autocomplete or suggest from post titles inside plugin

In order to properly enqueue a script you must use the wp_enqueue_script like this : wp_enqueue_script( ‘suggest’, get_template_directory_uri() . ‘/js/path/to/suggest.js’, array(‘jquery’), ‘1.0.0’, true ); The second parameter is the path to your JavaScript file, the third parameter is the dependencies the script relies on (since suggest is a jquery plugin, it must be loaded after … Read more

Adding auto-complete to custom gravity field not working

I have solved my problem using below code.So may be helpful for someone.I have tried by reference style for autocomplete <script> var locations=”<?php echo $json;?>”; var locations_array = JSON.parse(locations); locations_array.sort(); function monkeyPatchAutocomplete2() { jQuery(“#result”).remove(); // Don’t really need to save the old fn, // but I could chain if I wanted to var oldFn = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)