How to load jquery ui autocomplete combobox?

I have tried below script to load jQuery UI Autocomplete in theme. But it doesn't load their related scripts. How should I call it to work. wp_enqueue_script('jquery-ui-autocomplete'); I think below scripts are jQuery UI related scripts for autocomplete but it's doesn't load. <script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/jquery/ui/jquery.ui.core.min.js?ver=1.10.2'></script> <script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/jquery/ui/jquery.ui.widget.min.js?ver=1.10.2'></script> <script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/jquery/ui/jquery.ui.position.min.js?ver=1.10.2'></script> <script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/jquery/ui/jquery.ui.menu.min.js?ver=1.10.2'></script> <script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/jquery/ui/jquery.ui.autocomplete.min.js?ver=1.10.2'></script>
Category: Web

Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete

I am trying to write a plugin that adds a custom meta field to image attachments to give images a credit field. I use the 'attachment_fields_to_edit' and 'attachment_fields_to_save' filters. function hrld_attachment_field_credit( $form_fields, $post ) { $value = get_post_meta( $post->ID, '_hrld_media_credit', true ); $form_fields['hrld_media_credit']['label'] = 'Media Credit'; $form_fields['hrld_media_credit']['input'] = 'html'; $form_fields['hrld_media_credit']['html'] = '<input type="text" class="text hrld_media_credit_input" id="attachments-'.$post->ID.'-hrld_media_credit" name="attachments['.$post->ID.'][hrld_media_credit]" value="'.$value.'">'; $form_fields['hrld_media_credit']['helps'] = 'If photo was taken by a Herald photographer, use their username. e.g. "Bucky Badger" You should write "bbadger".'; return $form_fields; …
Category: Web

The dropdown list in autocomplete is not showing

I want to use jQuery UI and autocomplete in my search form. First I want to check whether any list will be displayed so I copied the code from the documentation and pasted it in my page template. The jQuery UI CSS and JS is loaded because I can see it in the Dev Tool in CHrome. However the dropdown list is not showing. I added the following HTML to my header.php <div class="ui-widget"> <label for="tags">Tags: </label> <input id="tags"> </div> …
Category: Web

Return an array from get_terms and store as JavaScript array for search autocomplete

I am trying to use wp_list_pluck to return an array of taxonomy names from get_terms. I'm not sure what I'm doing wrong, but this only echo's out "Array": $terms = get_terms(array( 'taxonomy' => 'state', 'hide_empty' => false, )); $term_ids = wp_list_pluck( $terms, 'name' ); echo $term_ids; Do you know how I can echo out an array of taxonomy names? The reason I am doing this is because I am wanting to get an array to convert it to a Javascript …
Category: Web

Maps search box autocomplete with callback JS function?

I am struggling with using a callback for my Google Maps API. I am trying to have a Goolge Maps autocomplete search box and collect the Lat and Long for the searched location. I've found this answer that works really well, but sometimes the search box won't load the location suggestions. I've found that this might be caused by the google.maps.event.addDomListener(window, 'load', initialize); that I use. Instead I've found that I need to use a callback in my script. I …
Category: Web

Hide autocomplete and fetching users when adding existing users WP multisite

Normally in the Add User section in a WP multisite, there is a section that you can add an existing user of the network to a subsite. When typing to add an existing user the autocomplete function starts showing existing user emails and names. I would like to disable the autocomplete function from work, but at the same time been able to add the existing user to the multisite.
Category: Web

Categories links suggestions same with link-to-post suggestion autocomplete from within the editor

I'm struggling to add links from within the content (WP Gutenberg Editor) to categories, in the same way WordPress deals with posts. Using autocomplete, when searching for an internal link, you can easily get to link to other posts, but not to categories. I find it hard to manually type /my-category/ always in the URL section and there's a huge probability one of the links to be broken. This is especially important for SEO, because category pages should also receive …
Category: Web

autocomplete="off" WordPress Login

I need to remove the auto complete password within the login page. I understand I need to set autocomplete="off". There is another article on this site (How to disable autocomplete on the wp-login.php page) which gives some solutions, but not being all that experienced not sure where to apply the code. I dont want anything fancy and do not mind editing wp-login.php directly, but where do I put autocomplete="off" and whats the complete syntax please? EDIT clearing internet history, when …
Category: Web

How can i find wrong word in search box and replace with correct word

I have a search form and Many site users search for the wrong words, I want to replace these wrong words with the right ones so that users can get results faster. I have been searching for this for several days but unfortunately I did not find any results. I'm looking for a way if a user types wrong words like this i love axqple i love vaple i love aple i love applle i love aplle Replace the wrong …
Category: Web

Form behaving differently on small screens vs desktop screen

I have an issue and I would be grateful for any ideas! I'm using a simple template bought at ThemeForest and I successfully added google maps autocomplete functionality for addresses in a field via a script on the contact 7 form (so far so good). However, when I make the window narrow (or I look at the website on the cellphone) the autocomplete script doesn't work. What could cause this?? big screen: https://i.imgur.com/EYnJqG7.png small screen: https://i.imgur.com/PuqQjv8.png
Category: Web

buddypress remove username from autocomplete

I am using Wordpress and Buddypress and i am trying to remove or hide the username that is being displayed in the autocomplete field of messages in Buddypress. Tried some tests from this post and also this , but with no luck. Did someone run into this issue? I was also looking around if i could just hide it with some css, but i think is not possible since the html is like that : <li class="ac_event ac_over"><span id="link-username" href="#"></span> …
Category: Web

Why is on status span no search results?

i have written some jQuery code for my wordpress plugin : jQuery("#kd_nr_search").autocomplete({ minLength: 2, source: function (term, response) { jQuery.post({ url:ttstickerz_object.ajax_url, data: { search: term, action: 'search_kunden_nr' }, method: "POST", dataType: 'json', success: function (data) { response( jQuery.map( data.kunden, function( item ) { jQuery.each(item,function(i,val) { val.label = item.name; }); return item; })); }, select: function(event, ui) { alert(ui.name); return false; } }); } }).data("ui-autocomplete")._renderItem = function( ul, item ) { return jQuery( "<li>" ) .append( "<a>" + item.name + "<br></a>" …
Category: Web

Internationalization autocomplete JS variable

I'm working in a plugin (My first plugin) that uses autocomplete (Via JQuery UI) via an array and I'm wondering if I have to translate the array too if I want to make my plugin fully translatable. jQuery(function(){ let supportedServices = [ 'Academia', 'Airbnb', 'Amazon', 'AppStore', 'Bandcamp', 'Blogger', ]; jQuery('#service_name ').autocomplete({ source: supportedServices, classes: { "ui-autocomplete": "contactmefy_ui_autocomplete" }, select: SomeFunction, }); }); In that case, it's a good idea to use the new wp-i18n JavaScript package? Internationalization in WordPress 5.0
Category: Web

jquery Autocomplete

I know somewhere is answer but i search everywhere. I have json-server with large data http://localhost:3004/kody Data looks like this: [ { "name": "something", "postCode": "something" }, { "name": "something", "postCode": "something" } ] now i want to do something like: when i search in first input by name it display name and postCode in one line: name: something (postCode: something) And when i click it populate first input with postCode and 2nd input with name. Can someone help me …
Category: Web

Back button not working after input / search submit

Thanks to Sally CJ I am super close to having everything figured out with an autocomplete search I am building out. The only problem I am having is the back button is not working after the user is taken to their new page (based on what they chose from the dropdown / autocomplete box). Sometimes the back button is simply greyed out and other times it will take the user to what seems like a random page (or whatever page …
Category: Web

Append Auto Suggest list to specific html tag?

Right now I have a script that auto suggests some post titles, using wordpress' suggest.js <script type="text/javascript"> var se_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>'; jQuery(document).ready(function() { jQuery('#love-input').suggest(se_ajax_url + '?action=se_lookup', { onSelect: function() { thevalue = this.value; thevalue = thevalue.split(' ('); jQuery('#love-input').val(thevalue[0]); } }); }); However, it appends the list to the bottom of my body tag, and I can't figure out how to put it in the specific div that I want. Help!
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.