Hello
Edit poll-model.php under models folder and replace
public function answer_result_replace_callback( $m, $question )
{
.....
}
with
public function answer_result_replace_callback( $m, $question ) {
$unique_id = $this->unique_id;
$return_string = '';
$is_voted = $this->is_voted();
$id = $this->ID;
if( $this->is_view_poll_results() ) {
$display_other_answers = false;
if( 'yes' == $question->allow_other_answers ) {
if( 'yes' == $question->display_other_answers_values ) {
$display_other_answers = true;
}
}
$percentages_decimals = 0;
if( isset( $this->percentages_decimals ) ) {
$percentages_decimals = $this->percentages_decimals;
}
if( isset( $this->sorting_results ) ) {
if( 'as_defined' == $this->sorting_results ) {
$question->sortAnswers( 'question_order', 'asc' );
}
elseif( 'database' == $this->sorting_results ) {
$order_dir = 'asc';
if( isset( $this->sorting_results_direction ) ) {
$order_dir = ( 'asc' == $this->sorting_results_direction ) ? 'asc' : 'desc';
}
$question->sortAnswers( 'ID', $order_dir );
}
elseif( 'alphabetical' == $this->sorting_results ) {
$order_dir = 'asc';
if( isset( $this->sorting_results_direction ) ) {
$order_dir = ( 'asc' == $this->sorting_results_direction ) ? 'asc' : 'desc';
}
$question->sortAnswers( 'alphabetical', $order_dir );
}
elseif( 'votes' == $this->sorting_results ) {
$order_dir = 'asc';
if( isset( $this->sorting_results_direction ) ) {
$order_dir = ( 'asc' == $this->sorting_results_direction ) ? 'asc' : 'desc';
}
$question->sortAnswers( 'votes', $order_dir );
}
else {
$order_dir = 'asc';
if( isset( $this->sorting_results_direction ) ) {
$order_dir = ( 'asc' == $this->sorting_results_direction ) ? 'asc' : 'desc';
}
$question->sortAnswers( 'question_order', $order_dir );
}
}
else {
$order_dir = 'asc';
if( isset( $this->sorting_results_direction ) ) {
$order_dir = ( 'asc' == $this->sorting_results_direction ) ? 'asc' : 'desc';
}
$question->sortAnswers( 'question_order', $order_dir );
}
$total_votes = $this->get_question_votes( $question );
$answer_other=new YOP_POLL_Answer_Model(0);
$answer_other->answer="Other";
$answer_other->votes=0;
foreach( $question->answers as $ans ) {
if( ( $ans->type == "other" ) && ! $display_other_answers ) {
$answer_other->votes++;
continue;
}
if( $ans->votes > 0 ) {
$percentages = floatval( $ans->votes * 100 / $total_votes );
}
else {
$percentages = 0;
}
if( function_exists( 'icl_translate' ) ) {
$ans->answer = icl_translate( 'yop_poll', $ans->ID . '_answer', $ans->answer );
}
/** Start Answer Description replace */
$pattern = '\[(\[?)(ANSWER_DESCRIPTION_CONTAINER)\b([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)';
$temp_string = preg_replace( "/$pattern/s", "", $m );
/** End Answer Description replace */
$ans->type = "text";
if( $ans->type == "text" ) {
$temp_string = str_ireplace( '%POLL-ANSWER-LABEL%', '<span>' . yop_poll_kses( stripslashes( $ans->answer ) ) . '</span>', $temp_string );
}
$temp_string = str_ireplace( '%POLL-ANSWER-RESULT-VOTES%', self::display_poll_result_votes( $ans->votes, $this->options ), $temp_string );
$temp_string = str_ireplace( '%POLL-ANSWER-RESULT-PERCENTAGES%', self::display_poll_result_percentages( round( $percentages, $percentages_decimals ), $this->options ), $temp_string );
$temp_string = str_ireplace( '%POLL-ANSWER-RESULT-BAR%', self::display_poll_result_bar( $ans->ID, $percentages, $this->options, $this->ID . $unique_id ), $temp_string );
$return_string .= $temp_string;
}
if( $answer_other->votes > 0 ) {
$percentages = floatval( $answer_other->votes * 100 / $total_votes );
}
else {
$percentages = 0;
}
if( function_exists( 'icl_translate' ) ) {
$answer_other->answer = icl_translate( 'yop_poll', $answer_other->ID . '_answer', $answer_other->answer );
}
/** Start Answer Description replace */
$pattern = '\[(\[?)(ANSWER_DESCRIPTION_CONTAINER)\b([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)';
$temp_string = preg_replace( "/$pattern/s", "", $m );
/** End Answer Description replace */
$answer_other->type = "text";
if( $answer_other->type == "text" ) {
$temp_string = str_ireplace( '%POLL-ANSWER-LABEL%', '<span>' . yop_poll_kses( stripslashes( $answer_other->answer ) ) . '</span>', $temp_string );
}
$temp_string = str_ireplace( '%POLL-ANSWER-RESULT-VOTES%', self::display_poll_result_votes( $answer_other->votes, $this->options ), $temp_string );
$temp_string = str_ireplace( '%POLL-ANSWER-RESULT-PERCENTAGES%', self::display_poll_result_percentages( round( $percentages, $percentages_decimals ), $this->options ), $temp_string );
$temp_string = str_ireplace( '%POLL-ANSWER-RESULT-BAR%', self::display_poll_result_bar( $answer_other->ID, $percentages, $this->options, $this->ID . $unique_id ), $temp_string );
$return_string .= $temp_string;
}
return $return_string;
}
Please note that these changes will be overwritten when updating the plugin.
Best
YOP Team