<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 鏈接到核心主題文件 正如你所學到的,WordPress主題是從許多不同的模板文件構建的。 至少這通常會包含一個sidebar.php,header.php和footer.php。 這些被稱為使用模板標簽,例如: - get_header(); - get_footer(); - get_sidebar(); 您可以通過命名文件sidebar-{your_custom_template} .php,header-{your_custom_template} .php和footer-{your_custom_template} .php來創建這些文件的自定義版本。 然后,您可以使用模板標簽與自定義模板名稱作為唯一的參數,如下所示: - get_header( 'your_custom_template' ); - get_footer( 'your_custom_template' ); - get_sidebar( 'your_custom_template' ); WordPress通過組合各種文件創建頁面。 除了標題,頁腳和側邊欄的標準文件外,您可以創建自定義模板文件,并使用get_template_part()在頁面中的任何位置調用它們。 要在主題中創建自定義模板文件,請為文件提供適當的名稱,并使用與標題,側邊欄和頁腳文件相同的自定義模板系統: ``` slug-template.php ``` 例如,如果要創建自定義模板來處理您的帖子內容,您可以創建一個名為content.php的模板文件,然后通過將文件名擴展為content-product.php來為產品內容添加特定的內容布局。 然后,您將在主題中加載此模板文件,如下所示: ``` get_template_part( 'content', 'product' ); ``` 如果您想添加更多的組織到您的模板,您可以將它們放置在您的主題目錄中的自己的目錄中。 例如,假設您為配置文件和位置添加了一些更多的內容模板,并將它們分組在其名為content-templates的目錄中。 稱為my-theme的主題的主題層次結構可能如下所示。 style.css和page.php都包含在上下文中。 - themes - my-theme - content-templates - content-location.php - content-product.php - content-profile.php - style.css 要包括您的內容模板,請將目錄名稱添加到slug參數中,如下所示: ``` get_template_part( 'content-templates/content', 'location' ); get_template_part( 'content-templates/content', 'product' ); get_template_part( 'content-templates/content', 'profile' ); ``` ## 鏈接到主題目錄 要鏈接到主題的目錄,您可以使用以下功能: ``` get_theme_file_uri(); ``` If you are not using a child theme, this function will return the full URI to your theme’s main folder. You can use this to reference sub-folders and files in your theme like this: ``` echo get_theme_file_uri( 'images/logo.png' ); ``` 如果您使用的是一個子主題,那么該函數將返回您的子主題中的文件的URI(如果存在)。 如果您的子主題中找不到文件,該函數將返回父主題中的文件的URI。 在分發主題或其他情況下,兒童主題可能活動或可能不活躍時,這一點特別重要。 要訪問主題目錄中文件的路徑,可以使用以下功能: ``` get_theme_file_path(); ``` 像get_theme_file_uri()一樣,如果子主題存在,它將訪問該文件的路徑。 如果在子主題中找不到文件,該函數將訪問父主題中文件的路徑。 在子主題中,您可以使用以下功能鏈接到父主題目錄中的文件URI或路徑: - get_parent_theme_file_uri(); - get_parent_theme_file_path(); 與get_theme_file_uri()一樣,您可以參考這樣的子文件夾和文件: ``` echo get_parent_theme_file_uri( 'images/logo.png' ); //or echo get_parent_theme_file_path( 'images/logo.png' ); ``` 引用可能不存在的文件時要小心,因為這些函數將返回URI或文件路徑,無論文件是否存在。 如果文件丟失,這些功能將返回一個斷開的鏈接。 >[warning] 注意:在WordPress 4.7中引入了函數get_theme_file_uri(),get_theme_file_path(),get_parent_theme_file_uri(),get_parent_theme_file_path()。 對于以前的WordPress版本,請使用get_template_directory_uri(),get_template_directory(),get_stylesheet_directory_uri(),get_stylesheet_directory()。 >[warning] 請注意,較新的4.7函數作為檢查過程的一部分運行較舊的功能,因此在可能時使用較新的功能是有意義的。 ## 模板中的動態鏈接 無論您的永久鏈接設置如何,您可以通過參考其唯一的數字ID(在管理界面的幾個頁面中)動態鏈接到頁面或發布頁面 ``` <a href="<?php echo get_permalink($ID); ?>">This is a link</a> ``` 這是創建頁面菜單的便捷方式,因為您可以稍后更改頁面段,而不會中斷鏈接,因為ID將保持不變。 但是,這可能會增加數據庫查詢。
                  <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>

                              哎呀哎呀视频在线观看