Support » Fixing WordPress » Auto suggest tags for form field on main page

  • Hi,

    WordPress has javascript built in called suggest.js. If anyone has experience with it, please help…

    I have a form field on my main page. I simply want my members to see tag suggestions while they type. The following thread, which is the only thread I can find on this topic, isn’t quite helping me.

    That thread points to a website which has a quick tutorial on how to implement tag suggestions for the admin section. However, I need to do this in the front end of my site. I tried using the code on that page and was unsuccessful.

    I assume javascript needs to be added to my header, then possibly something added to the form field code.

Viewing 1 replies (of 1 total)
  • I figured this out so I’m leaving the solution here for anyone in the future that wants to add tag suggestions to any input field on their WordPress site.

    This guy actually posted the solution on his site in ’07, but what he posted is more for the admin area.

    Using WordPress built-in tag auto complete script in your Plugins

    All I had to do was include some Javascript and insert the id of my tag field. It ended up being very simple… I was trying to make it way too complicated.

    First, have your site call the suggest.js that now comes with every WordPress site. It’s in your js/jquery folder I believe. Once you include the suggest.js, then you add the Javascript below which tells your site which text box you’re adding auto suggest to, and that’s it.

    <script type="text/javascript">
            jQuery('#YOURINPUTBOXIDHERE').suggest("<?php echo get_bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php?action=ajax-tag-search&tax=post_tag", {multiple:true, multipleSep: ","});
Viewing 1 replies (of 1 total)
  • The topic ‘Auto suggest tags for form field on main page’ is closed to new replies.