0

HI
I have problem with this code

<?php  $var = echo $this->Entity_RenderField($entity, $this->Entity_Field($entity, 'field_meni')); echo do_shortcode($var);?>

error:

Parse error: syntax error, unexpected 'echo' (T_ECHO) in /home/templates/test.html.php on line 86

when I do this:

<?php  $var = $this->Entity_RenderField($entity, $this->Entity_Field($entity, 'field_meni')); echo do_shortcode($var);?>

there is no error but also no output

and like this:

<?php  $var = $this->Entity_RenderField($entity, $this->Entity_Field($entity, 'field_meni')); echo do_shortcode('$var');?>

I only get $var as output

what am I doing wrong?

this is original code that works:

<?php echo do_shortcode('[WP_Restaurant_Menu id="1"]');?>

I am trying to display WP shortcode inside a shortcode

Thanks

Edited by mehnihma: added

2
Contributors
3
Replies
28
Views
3 Years
Discussion Span
Last Post by mehnihma
0

What do you want to echo?

What type of data is $var?

You have reference here of using do_shorcode() function.

Try to var_dump() $var after assigning value to it to see what have you got.

0

it is a string.
It need to be this [WP_Restaurant_Menu id="1"] that I get from $this->Entity_RenderField($entity, $this->Entity_Field($entity, 'field_meni'))

field_meni is a custom type in WP, text box from which I need to take a shortcode and display it

Edited by mehnihma: added

0

or something like this:

<?php  echo do_shortcode('[' .  echo $this->Entity_RenderField($entity, $this->Entity_Field($entity, 'field_test')) . ']');?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.