• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

BUG Cannot use external functions

Messages
2
Likes
0
Points
1
#1
How do I include my own written functions in a code snippet? I have made my functions globally visible in the theme functions.php, but it does not work. It does work in the old [INSERT_PHP] tags just by calling the function.
 

alexkovalev

Program developer
Staff member
Messages
240
Likes
19
Points
18
#2
Hi,

You must run a snippet everywhere to register function globally throughout the site. Could you show your code to give you advice?

Best regards, Alex
 
Messages
2
Likes
0
Points
1
#3
Hi Alex,

I have this function defined in functions.php:

function myFunction() { echo ' world'; }

and in version 1.3 this code:

[INSERT_PHP] echo 'Hello'; myFunction(); [/INSERT_PHP]

This displays: "Hello world"

In version 2 I put the same php code in a snippet and use it on a blank page. That display just "Hello ".