PHP question: echo inside echo to execute a shortcode?
-
Hi guys
I recognize that it is not very good with php, so I can not solve this problem:
I’m using a plugin to manage some galleries on my website
I would like to use the post_meta to change dinamically the value of a shortcode
I’m not sure that I explained well 🙂
anyway this is the code:<?php echo do_shortcode(‘[videogallery id=”
<?php $video = get_post_meta($post->ID, ‘Video’, $single = true); ?>
<?php if($video !== ”) { ?>
<?php echo $video; ?>
<?php } else { echo ”; } ?>“]’); ?>
this is the shortcode:
<?php echo do_shortcode(‘[videogallery id=”ID”]’); ?>
I’m trying to replace the “ID” with a post_meta but if I put this code:
<?php $video = get_post_meta($post->ID, ‘Video’, $single = true); ?>
<?php if($video !== ”) { ?>
<?php echo $video; ?>
<?php } else { echo ”; } ?>
it seems to crash everythingWhere I’m wrong?
I appreciate any suggestion 🙂
Thank you
The topic ‘PHP question: echo inside echo to execute a shortcode?’ is closed to new replies.