本文整理汇总了PHP中ap_net_vote函数的典型用法代码示例。如果您正苦于以下问题:PHP ap_net_vote函数的具体用法?PHP ap_net_vote怎么用?PHP ap_net_vote使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ap_net_vote函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_avatar
">
<!-- TODO: OPTION - avatar size in question list -->
<?php
echo get_avatar(get_the_author_meta('ID'), 45);
?>
</a>
</div>
<div class="ap-list-counts">
<?php
if (!ap_opt('disable_voting_on_question')) {
?>
<span class="ap-questions-count ap-questions-vcount">
<span><?php
echo ap_net_vote();
?>
</span>
<?php
_e('votes', 'ap');
?>
</span>
<?php
}
?>
</div>
<div class="ap-questions-summery no-overflow">
<span class="ap-questions-title entry-title" itemprop="title">
<a class="ap-questions-hyperlink" itemprop="url" href="<?php
示例2: ap_answer_get_the_net_vote
/**
* Return count of net vote of a answer
* @return integer
* @since 2.1
*/
function ap_answer_get_the_net_vote()
{
return ap_net_vote(ap_answer_the_object());
}
示例3: ap_vote_btn
/**
* Output voting button.
*
* @param int $post
*
* @return null|string
*
* @since 0.1
*/
function ap_vote_btn($post = false, $echo = true)
{
if (false === $post) {
global $post;
}
if ('answer' == $post->post_type && ap_opt('disable_voting_on_answer')) {
return;
}
if ('question' == $post->post_type && ap_opt('disable_voting_on_question')) {
return;
}
$nonce = wp_create_nonce('vote_' . $post->ID);
$vote = ap_is_user_voted($post->ID, 'vote');
$voted = $vote ? true : false;
$type = $vote ? $vote->type : '';
$html = '';
$html .= '<div data-id="' . $post->ID . '" class="ap-vote net-vote" data-action="vote">';
$html .= '<a class="' . ap_icon('vote_up') . ' ap-tip vote-up' . ($voted ? ' voted' : '') . ($type == 'vote_down' ? ' disable' : '') . '" data-query="ap_ajax_action=vote&type=up&post_id=' . $post->ID . '&__nonce=' . $nonce . '" href="#" title="' . __('Up vote this post', 'ap') . '"></a>';
$html .= '<span class="net-vote-count" data-view="ap-net-vote" itemprop="upvoteCount">' . ap_net_vote() . '</span>';
if ('question' == $post->post_type && !ap_opt('disable_down_vote_on_question') || 'answer' == $post->post_type && !ap_opt('disable_down_vote_on_answer')) {
$html .= '<a data-tipposition="bottom center" class="' . ap_icon('vote_down') . ' ap-tip vote-down' . ($voted ? ' voted' : '') . ($type == ' vote_up' ? ' disable' : '') . '" data-query="ap_ajax_action=vote&type=down&post_id=' . $post->ID . '&__nonce=' . $nonce . '" href="#" title="' . __('Down vote this post', 'ap') . '"></a>';
}
$html .= '</div>';
if ($echo) {
echo $html;
} else {
return $html;
}
}
示例4: ap_question_get_the_net_vote
/**
* Return count of net vote of a question
* @return integer
* @since 2.1
*/
function ap_question_get_the_net_vote()
{
return ap_net_vote(ap_question_the_object());
}
示例5: ap_vote_btn
/**
* Output voting button
* @param int $post
* @return null|string
* @since 0.1
*/
function ap_vote_btn($post = false, $echo = true)
{
if (false === $post) {
global $post;
}
if ('answer' == $post->post_type && ap_opt('disable_voting_on_answer')) {
return;
}
if ('question' == $post->post_type && ap_opt('disable_voting_on_question')) {
return;
}
$nonce = wp_create_nonce('vote_' . $post->ID);
$vote = ap_is_user_voted($post->ID, 'vote');
$voted = $vote ? true : false;
$type = $vote ? $vote->type : '';
ob_start();
?>
<div data-id="<?php
echo $post->ID;
?>
" class="ap-vote net-vote" data-action="vote">
<a class="<?php
echo ap_icon('vote_up');
?>
ap-tip vote-up<?php
echo $voted ? ' voted' : '';
echo $type == 'vote_down' ? ' disable' : '';
?>
" data-query="ap_ajax_action=vote&type=up&post_id=<?php
echo $post->ID;
?>
&__nonce=<?php
echo $nonce;
?>
" href="#" title="<?php
_e('Up vote this post', 'ap');
?>
"></a>
<span class="net-vote-count" data-view="ap-net-vote" itemprop="upvoteCount"><?php
echo ap_net_vote();
?>
</span>
<a data-tipposition="bottom" class="<?php
echo ap_icon('vote_down');
?>
ap-tip vote-down<?php
echo $voted ? ' voted' : '';
echo $type == 'vote_up' ? ' disable' : '';
?>
" data-query="ap_ajax_action=vote&type=down&post_id=<?php
echo $post->ID;
?>
&__nonce=<?php
echo $nonce;
?>
" href="#" title="<?php
_e('Down vote this post', 'ap');
?>
"></a>
</div>
<?php
$html = ob_get_clean();
if ($echo) {
echo $html;
} else {
return $html;
}
}
示例6: ap_vote_html
function ap_vote_html($post = false)
{
if (!$post) {
global $post;
}
$nonce = wp_create_nonce('vote_' . $post->ID);
?>
<div data-action="vote" data-id="<?php
echo $post->ID;
?>
" class="ap-voting net-vote">
<a class="ap-icon-thumbsup vote-up<?php
echo $post->user_voted_up ? ' voted' : '';
echo $post->user_voted_down ? ' disable' : '';
?>
" data-args="up-<?php
echo $post->ID . '-' . $nonce;
?>
" href="#" title="<?php
_e('Up vote this post', 'ap');
?>
"></a>
<span class="net-vote-count" data-view="ap-net-vote" itemprop="upvoteCount"><?php
echo ap_net_vote();
?>
</span>
<a class="ap-icon-thumbsdown vote-down<?php
echo $post->user_voted_down ? ' voted' : '';
echo $post->user_voted_up ? ' disable' : '';
?>
" data-args="down-<?php
echo $post->ID . '-' . $nonce;
?>
" href="#" title="<?php
_e('Down vote this post', 'ap');
?>
"></a>
</div>
<?php
}