Hook in the no products found template

Closes #11257

cc @jameskoster
This commit is contained in:
Mike Jolley 2016-08-08 13:43:42 +01:00
parent 40d395c16c
commit 87443763d8
3 changed files with 20 additions and 2 deletions

View File

@ -423,7 +423,7 @@ if ( ! function_exists( 'woocommerce_content' ) ) {
<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
<?php wc_get_template( 'loop/no-products-found.php' ); ?>
<?php do_action( 'woocommerce_no_products_found' ); ?>
<?php endif;
@ -2305,6 +2305,16 @@ if ( ! function_exists( 'woocommerce_account_edit_account' ) ) {
}
}
if ( ! function_exists( 'wc_no_products_found' ) ) {
/**
* Show no products found message.
*/
function wc_no_products_found() {
wc_get_template( 'loop/no-products-found.php' );
}
}
if ( ! function_exists( 'wc_get_email_order_items' ) ) {
/**

View File

@ -74,6 +74,7 @@ add_action( 'woocommerce_archive_description', 'woocommerce_product_archive_desc
*/
add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
add_action( 'woocommerce_no_products_found', 'wc_no_products_found' );
/**
* Product Loop Items.

View File

@ -87,7 +87,14 @@ get_header( 'shop' ); ?>
<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
<?php wc_get_template( 'loop/no-products-found.php' ); ?>
<?php
/**
* woocommerce_no_products_found hook.
*
* @hooked wc_no_products_found - 10
*/
do_action( 'woocommerce_no_products_found' );
?>
<?php endif; ?>