Skip to content

Instantly share code, notes, and snippets.

@jbrinley
Created June 12, 2014 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbrinley/e22de2703938e36d2c88 to your computer and use it in GitHub Desktop.
Save jbrinley/e22de2703938e36d2c88 to your computer and use it in GitHub Desktop.
Add tags to community events submission form. Add this to the end of the modules/taxonomy.php template.
<?php
$tags_string = '';
if ( isset($_POST['tax_input']) && isset($_POST['tax_input']['post_tag']) ) {
$tags_string = $_POST['tax_input']['post_tag'];
} elseif ( get_post() && get_the_ID() ) { // is there a current post?
$current_tags = get_the_terms(get_the_ID(), 'post_tag');
$current_tags = wp_list_pluck( $current_tags, 'name' );
$tags_string = implode(', ', $current_tags);
}
?>
<div class="tribe-events-community-details eventForm bubble" id="event_tag">
<table class="tribe-community-event-info" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" class="tribe_sectionheader">
<h4>Event Tags:</h4>
</td>
</tr>
<tr>
<td colspan="2">
<input type="text" id="event-tags" name="tax_input[post_tag]" size="40" value="<?php esc_attr_e($tags_string); ?>" />
<small>Separate tags with commas</small>
</td>
</tr>
</table>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment