do_shortcode with variable
-
Hello everybody,
Here’s a silly question. And I’m sure I should know how to do it but I think I don’t have all my neurones at the same place today.
So I have a php variable containing the shortcode of a cf7 form :
$formPerso = '[contact-form-7 id="1538" title="Form1"]';
(this example is fictional as I retrieve a custom field value in place of the shortcode. This means $formPerso value should be the full shortcode)
I would like to use this variable in a ‘do_shortcode’.
like this :
echo do_shortcode($formPerso);obviously it gives me an error. How should I do to make it works?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘do_shortcode with variable’ is closed to new replies.