I have problem with this code

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


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


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.

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

or something like this:

<?php  echo do_shortcode('[' .  echo $this->Entity_RenderField($entity, $this->Entity_Field($entity, 'field_test')) . ']');?>