A
A
Alexey2018-05-08 10:04:18
WordPress
Alexey, 2018-05-08 10:04:18

Why is there a problem with the output through sprintf in Wordpress?

I am modifying (using existing code) the LearnPress plugin so that the certificate displays the grade instead of percentages.
By analogy with the function of displaying the results in percentages, I made the output function in points.

public function get_mark_result() { 
    $premark = $this->get_percent_result();
    $mark = $premark * 1.2;

    return apply_filters( 'learn-press/user/course-mark-result', wp_sprintf( '%s', $mark ) );
  }

If format in sprints is '%s%%', then the result with a percent sign is output to the certificate. If I change it to %s, then the certificate is empty, but in the console I see the result as a number.
The data itself is superimposed on the image template, parsed and converted into its part using the fabric.js script.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question