Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php代码中添加一个短代码?_Php_Wordpress - Fatal编程技术网

如何在php代码中添加一个短代码?

如何在php代码中添加一个短代码?,php,wordpress,Php,Wordpress,在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-ty

在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)删除搜索表单包装。

从php文件运行短代码。我们使用do_短码功能,例如:

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

从php文件运行短代码。我们使用do_短码功能,例如:

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

您想从PHP运行某个短代码吗?这样,您的搜索框就可以与文章中生成的短代码[searchbox_tag]相同了?是的,这正是我想要的。您想从PHP运行某个短代码吗?这样你的搜索框就和一篇文章中的shortcode[searchbox_tag]一样了?是的,这正是我想要的。好吧,但是我把它放在哪里呢?如果你想替换..,就在@damann之后。。然后用do_shortcode语句替换get_template_部分行。好的,但是我应该把它放在哪里呢?如果你想替换..,就在@damann之后。。然后用do_shortcode语句替换get_template_part行。