Calling a function from functions.php
-
Hi, I am wanting to add an onclick=”myFunction()” function to a button in header.php
Where is the correct placement for the function? I’ve added it in functions.php:
function myFunction() { console.log("myFunction"); } add_action('wp_footer', 'myFunction');
But I get the error:
myFunction is not defined
Any clues? Thanks!
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Calling a function from functions.php’ is closed to new replies.