php - 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_s

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

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

Share Improve this question asked Jan 25, 2020 at 12:24 Faruk rızaFaruk rıza 982 silver badges11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

the error is saying to change ; to . - you will also want to remove the extra .:

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744805591a4594757.html

相关推荐

  • php - 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_s

    2天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信