我試圖盡可能地修改代碼,但我是初學者,任何幫助將不勝感激。啟動我的代碼時出現致命錯誤。此輸出有效public function renderMyBartag( $atts, $content = null ) { extract( shortcode_atts( array( 'foo' => 'something', 'color' => '#FF0000' ), $atts ) ); $content = wpb_js_remove_wpautop($content, true); // fix unclosed/unwanted paragraph tags in $content $output = "<div style='color:{$color};' data-foo='${foo}'>{$content}</div>"; return $output;}這不public function renderMyBartag( $atts, $content = null ) { extract( shortcode_atts( array( 'foo' => 'something', 'color' => '#FF0000' ), $atts ) ); $content = wpb_js_remove_wpautop($content, true); // fix unclosed/unwanted paragraph tags in $content $output = "<div class="container"> < class="learn-more"> <div class="circle"> <span class="icon arrow"></span> </div> <p class="button-text">{$foo}</p> </button> </div>"; return $output;}啟動我的代碼時出現致命錯誤。我只想將 html 代碼嵌入到我正在創建的短代碼中
1 回答

天涯盡頭無女友
TA貢獻1831條經驗 獲得超9個贊
在您的 $output 中,用單引號替換內部雙引號或轉義雙引號。
<?php
$o = " 'single quoute' ";
$o_esc = " \"escaped_doublequotes\" ";
- 1 回答
- 0 關注
- 111 瀏覽
添加回答
舉報
0/150
提交
取消