I can write and publish posts from my frontend - everything is fine. You know the backend: write-post-style, right? There it lists all existing tags.
How can I display all existing tags at frontend and use it the same way, like in backend? Especially the function "click on one existing tag" and use it with the post, that I am currently writing?
By the way: I want to use tags from my custom-taxonomy called "wissen"...
Do you know a solution, how to use this function at frontend?
This is my code: (you can see, how i do now the tags and i hope the code is everything important [my real file is a lot more code])
The code at the beginning of my form-page:
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == "new_post") {
$title = $_POST['title'];
$description = $_POST['description'];
$tags = $_POST['post_tags'];
$new_post = array(
'post_title' => $title,
'post_content' => $description,
'post_category' => array($_POST['cat']), // Usable for custom taxonomies too
'tags_input' => array($tags),
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
'post_type' => 'wissen' //'post',page' or use a custom post type if you want to
);
//SAVE THE POST
$pid = wp_insert_post($new_post);
//SET OUR TAGS UP PROPERLY
wp_set_post_tags($pid, $_POST['post_tags']);
//POST THE POST
do_action('wp_insert_post', 'wp_insert_post');
}
In my body:
<form id="new_post" name="new_post" method="post" action="" enctype="multipart/form-data">
<?php wp_dropdown_categories( 'tab_index=10&taxonomy=category&hide_empty=0' ); ?>
<textarea id="description" name="description"></textarea>
<textarea id="post_tags" name="post_tags"></textarea>
<input type="hidden" name="action" value="new_post" />
<input type="submit" value="Eintragen" id="submit" name="submit" />
</form>