Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
a98377a15c
|
@ -275,7 +275,7 @@ class WC_Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special check for shops with the product archive on front
|
// Special check for shops with the product archive on front
|
||||||
if ( $this->is_showing_page_on_front( $q ) && absint( $q->get( 'page_id' ) ) === wc_get_page_id( 'shop' ) ) {
|
if ( $q->is_page() && 'page' === get_option( 'show_on_front' ) && absint( $q->get( 'page_id' ) ) === wc_get_page_id( 'shop' ) ) {
|
||||||
// This is a front-page shop
|
// This is a front-page shop
|
||||||
$q->set( 'post_type', 'product' );
|
$q->set( 'post_type', 'product' );
|
||||||
$q->set( 'page_id', '' );
|
$q->set( 'page_id', '' );
|
||||||
|
|
|
@ -47,26 +47,26 @@ class WC_Product_Cat_Dropdown_Walker extends Walker {
|
||||||
*/
|
*/
|
||||||
public function start_el( &$output, $cat, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
public function start_el( &$output, $cat, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
||||||
|
|
||||||
if ( ! empty( $args['hierarchical'] ) )
|
if ( ! empty( $args['hierarchical'] ) ) {
|
||||||
$pad = str_repeat(' ', $depth * 3);
|
$pad = str_repeat(' ', $depth * 3);
|
||||||
else
|
} else {
|
||||||
$pad = '';
|
$pad = '';
|
||||||
|
}
|
||||||
|
|
||||||
$cat_name = apply_filters( 'list_product_cats', $cat->name, $cat );
|
$cat_name = apply_filters( 'list_product_cats', $cat->name, $cat );
|
||||||
|
|
||||||
$value = isset( $args['value'] ) && $args['value'] == 'id' ? $cat->term_id : $cat->slug;
|
$value = isset( $args['value'] ) && $args['value'] == 'id' ? $cat->term_id : $cat->slug;
|
||||||
|
$output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $value ) . "\"";
|
||||||
|
|
||||||
$output .= "\t<option class=\"level-$depth\" value=\"" . $value . "\"";
|
if ( $value === $args['selected'] || ( is_array( $args['selected'] ) && in_array( $value, $args['selected'] ) ) ) {
|
||||||
|
|
||||||
if ( $value == $args['selected'] || ( is_array( $args['selected'] ) && in_array( $value, $args['selected'] ) ) )
|
|
||||||
$output .= ' selected="selected"';
|
$output .= ' selected="selected"';
|
||||||
|
}
|
||||||
|
|
||||||
$output .= '>';
|
$output .= '>';
|
||||||
|
$output .= esc_html( $pad . _x( $cat_name, 'product category name', 'woocommerce' ) );
|
||||||
|
|
||||||
$output .= $pad . _x( $cat_name, 'product category name', 'woocommerce' );
|
if ( ! empty( $args['show_count'] ) ) {
|
||||||
|
$output .= ' (' . absint( $cat->count ) . ')';
|
||||||
if ( ! empty( $args['show_count'] ) )
|
}
|
||||||
$output .= ' (' . $cat->count . ')';
|
|
||||||
|
|
||||||
$output .= "</option>\n";
|
$output .= "</option>\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue