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

global $post; 
?>

<div class="ui vertical padded segment wedocs-feedback-wrap wedocs-hide-print">
    <?php
    $positive = (int) get_post_meta( $post->ID, 'positive', true );
    $negative = (int) get_post_meta( $post->ID, 'negative', true );

    $positive_title = $positive ? sprintf( _n( '%d person found this useful', '%d persons found this useful', $positive, 'campoal' ), number_format_i18n( $positive ) ) : __( 'No votes yet', 'campoal' );
    $negative_title = $negative ? sprintf( _n( '%d person found this not useful', '%d persons found this not useful', $negative, 'campoal' ), number_format_i18n( $negative ) ) : __( 'No votes yet', 'campoal' );
    ?>
    <h3 class="ui header">
        <?php _e( 'Was this article helpful to you?', 'campoal' ); ?>
    </h3>

    <span class="vote-link-wrap">
        <a href="#" class="ui primary button wedocs-tip" data-id="<?php the_ID(); ?>" data-type="positive" title="<?php echo esc_attr( $positive_title ); ?>">
            <?php _e( 'Yes', 'campoal' ); ?>

            <?php if ( $positive ) { ?>
                <span class="count"><?php echo number_format_i18n( $positive ); ?></span>
            <?php } ?>
        </a>
        <a href="#" class="ui button wedocs-tip" data-id="<?php the_ID(); ?>" data-type="negative" title="<?php echo esc_attr( $negative_title ); ?>">
            <?php _e( 'No', 'campoal' ); ?>

            <?php if ( $negative ) { ?>
                <span class="count"><?php echo number_format_i18n( $negative ); ?></span>
            <?php } ?>
        </a>
    </span>
</div>