【问题标题】:PHP within HTML that is within a wordpress shortcode位于 wordpress 短代码中的 HTML 中的 PHP
【发布时间】:2014-04-04 08:36:41
【问题描述】:

好的,基本上我正在尝试换行;

<a class="userpro-init-chat" href="#" data-chat_with="<?php echo get_the_author_meta('ID'); ?> " data-chat_from="<?php echo get_current_user_id();?>" >Reply to this ad!</a>

在模板中的 wordpress 短代码中。应该够简单吧?;

<?php echo  do_shortcode('[userpro_private]' <a class="userpro-init-chat" href="#" data-chat_with="<?php echo get_the_author_meta('ID'); ?> " data-chat_from="<?php echo get_current_user_id();?>" >Reply to this ad!</a> '[/userpro_private]'); ?>

但是我不断收到错误“解析错误:语法错误,第 46 行 /home/content/67/11982267/html/tester/wp-content/themes/twentytwelve/content.php 中的意外 T_CLASS"

谁能看出这是为什么?

我是 php 的新手,所以我可能在某个地方做错了,这对其他人来说很明显,但我非常感谢任何人的帮助!

非常感谢, 詹姆斯

【问题讨论】:

    标签: php html wordpress templates shortcode


    【解决方案1】:

    我希望这能解决问题。

    $text = "<a class='userpro-init-chat' href='#' data-chat_with='". get_the_author_meta('ID')."' data-chat_from= '".get_current_user_id()."' >Reply to this ad!</a>";
    
    echo  do_shortcode('[userpro_private]'.$text.'[/userpro_private]'); 
    

    【讨论】:

      猜你喜欢
      • 2013-11-24
      • 2014-08-27
      • 1970-01-01
      • 2018-03-07
      • 1970-01-01
      • 1970-01-01
      • 2018-06-04
      • 2014-06-13
      相关资源
      最近更新 更多