Hi Nitrat,
You are mixing php and js I think.
do_shortcode is php. Try it without if the js is running in the content of the page (not in a separate js file) or close and open php before and after if it’s in a php file.
Let us know if this helps.
Thread Starter
Nitrat
(@nitrat)
My js code is in the “html” field of the form. How to do this there?
I have no idea if you can use js inside a HTML field. But if it’s possible, don’t use do_shortcode. You really only use that in php.
Thread Starter
Nitrat
(@nitrat)
Ok. What code is needed for php?
Thread Starter
Nitrat
(@nitrat)
add_shortcode('mysum','tsum_mysum');
function tsum_mysum() {
$li = do_shortcode('[gravitywp_count formid="5" field="10" created_by="current"]');
return $li;
}
So?
Hi Nitrat,
You can use the shortcode on the frontpage without using do_shortcode. If you use it on a php page, than you use do_shortcode. I have no idea what you want to accomplish where, but this is not the way to do it. Start by reading the docs here.
You’re question has nothing to do with the working of this plugin (the plugin does what it has to do). If you need help with custom code, please ask help from an expert on Codeable.
Kind regards and good luck with your project,
Erik
Thread Starter
Nitrat
(@nitrat)
I guessed it myself! This code passes the value of “li” to the required field (dynamically populate)-
add_filter('gform_field_value_li', 'gw_li');
function gw_li() {
$li = do_shortcode('[gravitywp_count formid="5" number_field="10" created_by="current"]');
return $li;
}