[英]PHP within HTML that is within a wordpress shortcode
好的,基本上我正在嘗試包裝;
<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]'); ?>
但是我不斷收到錯誤“解析錯誤:語法錯誤,/home/content/67/11982267/html/tester/wp-content/themes/twentytwelve/content.php 中的意外 T_CLASS 在第 46 行”
誰能看出這是為什么?
我在 php 方面相當新,所以 iv 可能在其他人很明顯的地方做錯了什么,但我真的很感激任何人的幫助!
非常感謝,詹姆斯
我希望這能解決問題。
$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]');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.