Woocommerce/WP 简码替换
Woocommerce/WP shortcode replacement
我有一个 woocommerce 网站,希望搜索功能也能根据产品标签提取产品。
我找到了一个可以做到这一点的插件,但我没有从开发人员那里得到太多帮助。
基本上我有一个高级 serach 插件的简码,我需要将它放在主题 functions.php 文件中。
我是新手,不知道去哪里 place/replace。
这将是简码:
echo do_shortcode( '[aws_search_form id="YOUR_ID"]' );
这是主题的搜索表单代码:
<?php if ( (isset($shopkeeper_theme_options['main_header_search_bar'])) &&
($shopkeeper_theme_options['main_header_search_bar'] == "1") ) : ?>
<li class="search-button">
<a class="tools_button">
<span class="tools_button_icon">
<?php if (
(isset($shopkeeper_theme_options['main_header_search_bar_icon'])) &&
($shopkeeper_theme_options['main_header_search_bar_icon'] != "") ) : ?>
<img src="<?php echo
esc_url($shopkeeper_theme_options['main_header_search_bar_icon']); ?>">
<?php else : ?>
<i class="spk-icon-search"></i>
<?php endif; ?>
</span>
</a>
</li>
<?php endif; ?>
谢谢
您不仅可以在 functions.php、
中,还可以在主题的任何文件中添加简码
所以你可以像这样修改你的search.php:
<?php if ( (isset($shopkeeper_theme_options['main_header_search_bar'])) &&
($shopkeeper_theme_options['main_header_search_bar'] == "1") ) : ?>
<?php echo do_shortcode( '[aws_search_form id="YOUR_ID"]' ); ?>
<?php endif; ?>
我有一个 woocommerce 网站,希望搜索功能也能根据产品标签提取产品。 我找到了一个可以做到这一点的插件,但我没有从开发人员那里得到太多帮助。 基本上我有一个高级 serach 插件的简码,我需要将它放在主题 functions.php 文件中。 我是新手,不知道去哪里 place/replace。 这将是简码:
echo do_shortcode( '[aws_search_form id="YOUR_ID"]' );
这是主题的搜索表单代码:
<?php if ( (isset($shopkeeper_theme_options['main_header_search_bar'])) &&
($shopkeeper_theme_options['main_header_search_bar'] == "1") ) : ?>
<li class="search-button">
<a class="tools_button">
<span class="tools_button_icon">
<?php if (
(isset($shopkeeper_theme_options['main_header_search_bar_icon'])) &&
($shopkeeper_theme_options['main_header_search_bar_icon'] != "") ) : ?>
<img src="<?php echo
esc_url($shopkeeper_theme_options['main_header_search_bar_icon']); ?>">
<?php else : ?>
<i class="spk-icon-search"></i>
<?php endif; ?>
</span>
</a>
</li>
<?php endif; ?>
谢谢
您不仅可以在 functions.php、
中,还可以在主题的任何文件中添加简码所以你可以像这样修改你的search.php:
<?php if ( (isset($shopkeeper_theme_options['main_header_search_bar'])) &&
($shopkeeper_theme_options['main_header_search_bar'] == "1") ) : ?>
<?php echo do_shortcode( '[aws_search_form id="YOUR_ID"]' ); ?>
<?php endif; ?>