the answer for all question about Oxygen Builder plugin and WordPress

Help please? In a php Code Block, I have a very simple function, to return a str

Help please? In a php Code Block, I have a very simple function, to return a string.

function tz3(){ return “foo”; }

But when I try to display that string (in a Text block, using PHP Function Return value) I get “function does not exist“. What am I doing wrong?
ANSWER

Place the function definition code outside of the Oxygen editor using a plugin like Code Snippets. Functions defined in a Oxygen’s Code Block are specific to that instance of Code Block. They are not present i.e., can’t be accessed outside.

Sridhar Katakam
Thanks everyone!



Source

5 Comments
  1. Udoro 'Cracka' Essien says

    In the PHP Function Return value, make sure you don’t include () in the function name

  2. Matt Hias says

    Did you place your Code Block with the function before the point you’re calling it?
    Please share
    a) a screenshot of your Code Block
    b) a screenshot of the element you’re accessing the function
    c) a screenshot of the structure panel with marked Code Block and calling element.

  3. Sridhar Katakam says

    Place the function definition code outside of the Oxygen editor using a plugin like Code Snippets.

  4. Floris van Leeuwen says

    Might be that the function call (PHP return value) happens after the function definition. You can use a code snippets plugin to define your functions, instead of a code block.

  5. Juan Carlos Garcia Alonso says

    Nice discussion, please update the post with the answer, so the next person with the same issue would find the solution easily. Most of us find solution to 90% of the issues searching the group, but when the solution is buried in the comments is difficult.

Leave A Reply

Your email address will not be published.

Oxyrealm Docs