Hi, might be a real dumb question… but does the gform_loaded hook NOT work from within a theme / child theme?
Code works from within a plugin. Same code in the child theme produces nothing.
Thanks!
Hi, might be a real dumb question… but does the gform_loaded hook NOT work from within a theme / child theme?
Code works from within a plugin. Same code in the child theme produces nothing.
Thanks!
You will need to add it into the functions.php of the theme you are working from.
Hi Mr Roboto, thanks for your response.
Unfortunately when I add the same code from the plugin to the child-theme/functions.php file, it doesn’t work. Is it supposed to work from within a theme?
Thanks again.
Can you show your code / file structure?
Hi Mr Roboto,
I’m just using a very simple test:
plugin/plugin.php
function my_plugin_function()
{
echo "This is from the plugin";
//Do something here
}
add_action('gform_loaded', 'my_plugin_function', 10, 0);
child-theme/functions.php
function my_theme_function()
{
echo "This is from the theme";
//Do something here
}
add_action('gform_loaded', 'my_theme_function', 10, 0);
The plugin echoes, the theme does not.
Silly question, but have you correctly loaded the child theme?
I believe so. Its a simple / custom child-theme of the Parent Beaver Builder theme that we have been using for the past 2 years.
Does including my code into your child-theme/functions.php file work for you?
Thanks!
Try adding this filter in mu-plugins. It might execute earlier than theme loading, even. I remember looking at it some while ago from the same perspective.