Hello @d2092001
Could you please try the following snippet inside a MU plugin (ref: https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins)
<?php
add_filter( 'forminator_quizzes_render_knowledge_result', 'wpmudev_reduce_total_count_quiz', 10, 3 );
function wpmudev_reduce_total_count_quiz( $knowledge_result_html, $text, $model ){
if( $model->id != 1356 ){
return $knowledge_result_html;
}
preg_match_all('!\d+!', $knowledge_result_html, $matches);
if( is_array( $matches ) ){
if( is_array( $matches[0] ) ){
$your_num = $matches[0][0];
$total = $matches[0][1];
if( $your_num > 0 ){
$pos = strpos($knowledge_result_html, $your_num);
if ($pos !== false) {
$knowledge_result_html = substr_replace($knowledge_result_html, $your_num-2, $pos, strlen($your_num));
}
}
if( $total > 0 ){
$pos = strpos($knowledge_result_html, $total);
if ($pos !== false) {
$knowledge_result_html = substr_replace($knowledge_result_html, $total-2, $pos, strlen($total));
}
}
}
}
return $knowledge_result_html;
}
If you just want to reduce the count of %YourNum% and not %Total%, then you can remove this condition from the snippet above:
if( $total > 0 ){
$pos = strpos($knowledge_result_html, $total);
if ($pos !== false) {
$knowledge_result_html = substr_replace($knowledge_result_html, $total-2, $pos, strlen($total));
}
}
Warm regards,
Dimitris