<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                現在我們知道如何創建一個基本的短代碼,以及如何使用它作為自我關閉和封閉,我們將使用短代碼`[$tag]`和處理函數中的參數。 短碼`[$tag]`可以接受參數,稱為屬性: ``` [wporg title="WordPress.org"] Having fun with WordPress.org shortcodes. [/wporg] ``` Shortcode處理函數可以接受3個參數: $atts - array - [$tag]屬性 $content - string - 發布內容 $tag - string - [$tag]的名稱(即短碼的名稱) ``` function wporg_shortcode($atts = [], $content = null, $tag = '') {} ``` ## 解析屬性 對于用戶來說,短信只是在帖子內容中帶有方括號的字符串。 用戶不知道哪些屬性可用,幕后發生什么。 對于插件開發人員,無法強制使用屬性的策略。 用戶可以包括一個屬性,兩個或全部。 為了控制如何使用短碼: - 聲明處理函數的默認參數 - 使用array_change_key_case()對屬性數組執行關鍵案例的歸一化 - 使用shortcode_atts()提供默認值array和user $ atts來解析屬性 - 在返回之前確保輸出 ## 完整例子 完整的示例使用基本的短代碼結構,處理自我關閉和封閉場景,縮短代碼并確保輸出。 一個[wporg]短碼,將接受一個標題,并將顯示一個框,我們可以用CSS風格。 ``` <?php function wporg_shortcode($atts = [], $content = null, $tag = '') { // normalize attribute keys, lowercase $atts = array_change_key_case((array)$atts, CASE_LOWER); // override default attributes with user attributes $wporg_atts = shortcode_atts([ 'title' => 'WordPress.org', ], $atts, $tag); // start output $o = ''; // start box $o .= '<div class="wporg-box">'; // title $o .= '<h2>' . esc_html__($wporg_atts['title'], 'wporg') . '</h2>'; // enclosing tags if (!is_null($content)) { // secure output by executing the_content filter hook on $content $o .= apply_filters('the_content', $content); // run shortcode parser recursively $o .= do_shortcode($content); } // end box $o .= '</div>'; // return output return $o; } function wporg_shortcodes_init() { add_shortcode('wporg', 'wporg_shortcode'); } add_action('init', 'wporg_shortcodes_init'); ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看