<?php
/**
 * @package WordPress
 * @subpackage Campoal
 */

global $campoal_options;
global $post;

// Does the user want tag?
$enable_tag 				= give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );

$petition_date = isset($campoal_options['conikal_petition_date_field']) ? $campoal_options['conikal_petition_date_field'] : 1;

$form_id    = $post->ID;
$date       = get_the_date('', $form_id);
$tags       = wp_get_post_terms($form_id, 'give_forms_tag');
?>

<?php if ($enable_tag) : ?>
    <div class="give-date-tags-section">
        <?php if ($petition_date == 1) : ?>
            <div class="ui right floated tiny header"><?php echo esc_html($date) ?></div>
        <?php endif; ?>
        <?php if (is_array($tags)) { ?>
            <div class="give-tag-section">
                <div class="ui labels">
                    <?php foreach($tags as $tag) { ?>
                        <a href="<?php echo esc_url(get_term_link($tag->term_id)) ?>" class="ui label" data-bjax><?php echo esc_html($tag->name) ?></a>
                    <?php } ?>
                </div>
            </div>
        <?php } ?>
    </div>
<?php endif; ?>