【问题标题】:Embedding PHP shortcode in wordpress Template在 wordpress 模板中嵌入 PHP 短代码
【发布时间】:2016-04-22 20:47:01
【问题描述】:
<img src="<?php echo $newurl; ?>" alt="01-slide-Eurasia" width="120" height="90" />


<?php echo do_shortcode( '[simple_tooltip content="Click Now to Download"]' . $f . '[/simple_tooltip]' ); ?>

我需要$f 需要替换为&lt;img src="&lt;?php echo $newurl; ?&gt;" alt="01-slide-Eurasia" width="120" height="90" /&gt;

我试过了,但是出错了。请帮忙

【问题讨论】:

    标签: wordpress shortcode


    【解决方案1】:

    php 变量不能在字符串中回显,而是连接起来。

    <?php echo do_shortcode( '[simple_tooltip content="Click Now to Download"]<img src="'.$newurl.'" alt="01-slide-Eurasia" width="120" height="90" />[/simple_tooltip]' ); ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-18
      • 2013-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-13
      相关资源
      最近更新 更多