Categories
CMS Development Wordpress

Echo short code syntax

I want to make dynamic short code so insert php code of metabox text value to short code.

I wrote this:

<?php echo do_shortcode("[svg-flag flag=\"".get_post_meta($post->ID, 'ozellikler_text', true);".\"]"); ?>

Error :

Parse error: syntax error, unexpected ';', expecting ',' or ')' in /home/deniztas/themeforest-deneme2.deniz-tasarim.site/wp-content/themes/html5blank-stable/my_homepages/right.php on line 14

I explain what I want step by step:

There is a short code which shows country flags.

[svg-flag flag="tr"]

For example, this code shows Turkey (tr) flag.

I want to change the "tr"to dynamic metabox text value:

<?php  echo get_post_meta($post->ID, 'ozellikler_text', true) ?>

How can I do it? What is true syntax or simpler way than mine?

I ask this here instead of stackoverflow because I think maybe it needs wordpress info.Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *