예제 #1
0
function nh_vote_it_link($post_id = null, $link_text = null, $already_voted = null, $echo = true)
{
    global $current_user;
    global $app_url;
    $app_url = get_bloginfo('url');
    //	$already_voted = __('You already voted on this', 'vote');
    global $user_ID, $post;
    if (is_null($post_id)) {
        $post_id = $post->ID;
    }
    $vote_count = nh_get_vote_count($post_id);
    ob_start();
    if (!nh_user_has_voted_post($user_ID, $post_id)) {
        echo '<a id="votethis"';
        if (!is_user_logged_in()) {
            echo 'href="#"';
        }
        echo '  title="Vote on this Idea" class="vote votethis nh-btn-blue" data-post-id="' . $post_id . '" data-user-id="' . $user_ID . '">Vote</a>';
    } else {
        // Seems to duplicate php if/else on page ??
        echo '<span class="byline"><a id="votedthis" title="See your other Votes" href="' . $app_url . '/author/' . $current_user->user_login . '" class="votedthis nhline">You voted</a></span>';
    }
    if ($echo) {
        echo apply_filters('nh_links', ob_get_clean());
    } else {
        return apply_filters('nh_links', ob_get_clean());
    }
}
예제 #2
0
        ?>
				</p>
<?php 
        $guide_answer = get_post_meta($post->ID, 'gde-answer', true);
        if ($guide_answer) {
            echo '<p class="comment-meta"><span class="answered"><a class="nhline" href="' . $guide_answer . '" title="Read this answer">Read the answer!</a></span></p>';
        }
        ?>
															
			</div><!--/ vote question-->
			<div class="nh-vote-count"><span class="nh-vote-count  vote-<?php 
        echo $post->ID;
        ?>
">
<?php 
        echo nh_get_vote_count($post->ID);
        ?>
</span>
<br/><span class="small-vote">votes</span>
				</div>											
			</li>
<?php 
    }
    $total_pages = $fdbk_query->max_num_pages;
    if ($total_pages > 1) {
        $current_page = max(1, get_query_var('paged'));
        echo paginate_links(array('base' => get_pagenum_link(1) . '%_%', 'format' => '/page/%#%', 'current' => $current_page, 'total' => $total_pages));
    }
    wp_reset_query();
}
?>