簡體   English   中英

如何將簡碼放入php代碼?

[英]How would I put a shortcode into php code?

在Wordpress網站上工作。 我需要在其中一個php文件中添加一個簡碼(替換硬編碼到標頭php文件中的搜索條形碼)。 如何將簡碼添加到php頭文件中?

這是我正在查看的代碼:

<?php if ( (is_front_page()) && (of_get_option('g_search_box_id') == 'yes') ) { ?>
    <div class="search-form-wrap hidden-phone" data-motopress-type="static" data-motopress-static-file="static/static-search.php">
        <?php get_template_part("static/static-search"); ?>
    </div>
<?php } ?>

並且我需要使用其他短代碼搜索表單(用於mls)刪除search-form-wrap。

從php文件運行短代碼。 我們使用do_shortcode函數,例如:

// Use shortcodes in form like Landing Page Template.
echo do_shortcode( '[contact-form-7 id="91" title="quote"]' );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM