我如何将 HTML 代码放入 PHP 以进行可视化作曲家插件开发?

我试图尽可能地修改代码,但我是初学者,任何帮助将不胜感激。


启动我的代码时出现致命错误。


此输出有效


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 代码嵌入到我正在创建的短代码中


HUWWW
浏览 98回答 1
1回答

天涯尽头无女友

在您的 $output 中,用单引号替换内部双引号或转义双引号。<?php&nbsp; &nbsp; $o = " 'single quoute' ";&nbsp; &nbsp; $o_esc = " \"escaped_doublequotes\" ";
打开App,查看更多内容
随时随地看视频慕课网APP