我想在我的自定义插件开发中显示默认的Woo-commerce产品过滤器。我已将以下短代码用于展示产品。
echo do_shortcode("[products]");
它正在工作并且产品也正在显示,但我也想在Woo-commerce中显示默认产品过滤器,我使用了以下短代码,但未显示默认产品过滤器。
[woocommerce_product_filter_products]
[woocommerce_product_filter]
在插件开发或其他页面中还有其他显示默认产品过滤器的方法吗?
答案 0 :(得分:0)
注册边栏:
if ( function_exists('shortcodeWidget') )
register_sidebar(array(
'name' => 'Shortode widget for filter',
'id' => 'shortcode-widget',
'before_widget' => '<div class = "filterWidget">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
)
);
注册简码后
function shortcodeSidebar(){
ob_start();
get_sidebar('shortcode-widget');
$sidebar= ob_get_contents();
ob_end_clean();
return $sidebar;
}
add_shortcode('filterWoocommerce', 'shortcodeSidebar');
然后在自定义窗口小部件中添加过滤器。