Override vote icons in 4.1.4
Hi – is there any function that can override the voting icons ? I copied /includes/votes.php to /mytheme/anspress/includes/votes.php to make changes, but this doesn’t seem to work.
Any pointers ?
Thanks
@Rahul – what I am looking to achieve is the below
This function, from votes.php – see the bold and italic text.
function ap_vote_btn( $post = null, $echo = true ) {
$post = ap_get_post( $post );
if ( ! $post || ‘answer’ === $post->post_type && ap_opt( ‘disable_voting_on_answer’ ) ) {
return;
}
if ( ‘question’ === $post->post_type && ap_opt( ‘disable_voting_on_question’ ) ) {
return;
}
$vote = is_user_logged_in() ? ap_get_vote( $post->ID, get_current_user_id(), ‘vote’ ) : false;
$voted = $vote ? true : false;
if ( $vote && ‘1’ === $vote->vote_value ) {
$type = ‘vote_up’;
} elseif ( $vote && ‘-1’ === $vote->vote_value ) {
$type = ‘vote_down’;
} else {
$type = ”;
}
$data = [ ‘post_id’ => $post->ID, ‘active’ => $type, ‘net’ => ap_get_votes_net(), ‘__nonce’ => wp_create_nonce( ‘vote_’ . $post->ID ) ];
$html = ”;
$html .= ‘<div id=”vote_’ . $post->ID . ‘” class=”ap-vote net-vote” ap-vote=” . wp_json_encode( $data ) . ”>’;
$html .= ‘<a class=”fa fa-angle-double-up ap-tip vote-up‘ . ($voted ? ‘ voted’ : ”) . ($vote && ‘vote_down’ === $type ? ‘ disable’ : ”) . ‘” href=”#” title=”‘ . __( ‘Up vote this post’, ‘anspress-question-answer’ ) . ‘” ap=”vote_up”></a>’;
$html .= ‘<span class=”net-vote-count” data-view=”ap-net-vote” itemprop=”upvoteCount” ap=”votes_net”>’ . ap_get_votes_net() . ‘</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=”apicon-thumb-down ap-tip vote-down’ . ($voted ? ‘ voted’ : ”) . ($vote && ‘vote_up’ === $type ? ‘ disable’ : ”) . ‘” href=”#” title=”‘ . __( ‘Down vote this post’, ‘anspress-question-answer’ ) . ‘” ap=”vote_down”></a>’;
}
$html .= ‘</div>’;
if ( ! $echo ) {
return $html;
}
echo $html; // xss okay.
}
What I am looking for is a function that will override this.