Tags autocomplete in frontend post form?

This topic contains 7 reply and 3 voices, and was last updated by kolhoffmmm 10 years, 10 months ago
Viewing 7 Posts - 1 through 7 (of 7 total)
Author Posts
May 8, 2013 at 4:42 pm 3361
kolhoffmmm Hello, I was wondering if it is possible to have an autocomplete functionnality when using the tags field in frontent post publishing? I have read that WordPress have a built-in tag auto complete script, but no idea how to use it for the front end link
May 9, 2013 at 11:07 am 3393
Tareq Hasan Tareq Hasan

There’s lots of ways it can be accomplished 🙂

May 13, 2013 at 3:12 pm 3557
jeremymatter jeremymatter

Thank you a lot for your answer, I will go through the documentation!

Cheers!

May 15, 2013 at 12:29 pm 3652
kolhoffmmm kolhoffmmm

Your tag functionality for custom tags does not work. I get it working with a drop down, but it means you can not create new tags. and even with the drop down it does not work it some how allocates an id as the custom tag and creates a tag like that

ninja forms is having a solution where it seems to be working

http://demo.wpninjas.com/ninja-forms/post-creation/

May 15, 2013 at 12:37 pm 3654
jeremymatter jeremymatter

For my use, I finally didn’t need to have the autocomplete functionnality on the tag field (and it worked only for 1 tag after a quick test), but work very fine with a text field :

<script>
    jQuery(document).ready(function($) {
        var availableTags = [
	<?php
	    $recentPosts = new WP_Query();
	    $recentPosts->query(&#039;showposts=100&#039;);
	    while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
	    "<?php echo get_post_meta( $post->ID, &#039;marque&#039;, true ); ?>",
	    <?php endwhile; ?>
	];

	$( "#marque" ).autocomplete({
	    source: availableTags
	});
});
	</script>
May 15, 2013 at 12:39 pm 3658
kolhoffmmm kolhoffmmm

and how do you save it into tag form afterwards ?

May 15, 2013 at 12:41 pm 3662
jeremymatter jeremymatter

The id #marque is “connected” to the id of your field, afer you only have tu do a query to retrieve the tags and format them according to the syntax example of the autocomplete jQuery plugin,

May 15, 2013 at 12:47 pm 3663
kolhoffmmm kolhoffmmm

What I actually mean is how do you save it as a proper taxonomy afterward in wordpress. so it is availabe as a non hierarchical taxonomy

Viewing 7 Posts - 1 through 7 (of 7 total)