Skip Navigation

[Resolved] calculate shortcode

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by laszloB 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#918426
something_wrong.png

I am trying to:
https://toolset.com/forums/topic/calculator/#post-24976

function calculate_shortcode($atts,$content=null) {
$content = wpv_do_shortcode($content);
$content = eval("return $content;");
return round($content);
}
add_shortcode('calculate', 'calculate_shortcode');

I have DIVI child theme (function.php)
When I insert code I got error message. See screenshot

#918441

Try this:

do_shortcode

...instead of this:

wpv_do_shortcode
#918485
something_not_wrong.jpg
something_wrong2.jpg

Same error 🙁

if I delete this line, file update possible

$content = eval("return $content;");
#918841

Please download this file using FTP, then make the change on your local development environment, then upload the file again with FTP. The error may be caused by a security system on your server that doesn't allow "eval" in code. It can be a security risk, so this file modification may be blocked by the server.

#919550

YESSSS!
It works.
Thanks