Удалите стандартную оболочку Woocommerce & lt; div class = & quot; столбцы woocommerce — » & gt;

Я использую пользовательскую тему с woocommerce. Моя главная страница отображает товары по категориям, и они заключены в стандартный блок woocommerce <div class="woocommerce columns-4">, Мне нужно удалить это. В папке woocommerce я нашел только одну ссылку на этот блок в woocommerce / includes / class-wc-shortcodes.php

return '<div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>';

Я пытался изменить это на return '';, но все еще есть та же самая обертка.

Есть ли возможность убрать этот блок?

Функция с <div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>' ниже.

public static function product_categories( $atts ) { public static function product_categories( $atts ) {
global $woocommerce_loop;

if ( isset( $atts['number'] ) ) {
$atts['limit'] = $atts['number'];
}

$atts = shortcode_atts( array(
'limit'      => '-1',
'orderby'    => 'name',
'order'      => 'ASC',
'columns'    => '4',
'hide_empty' => 1,
'parent'     => '',
'ids'        => '',
), $atts, 'product_categories' );

$ids        = array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) );
$hide_empty = ( true === $atts['hide_empty'] || 'true' === $atts['hide_empty'] || 1 === $atts['hide_empty'] || '1' === $atts['hide_empty'] ) ? 1 : 0;

// Get terms and workaround WP bug with parents/pad counts.
$args = array(
'orderby'    => $atts['orderby'],
'order'      => $atts['order'],
'hide_empty' => $hide_empty,
'include'    => $ids,
'pad_counts' => true,
'child_of'   => $atts['parent'],
);

$product_categories = get_terms( 'product_cat', $args );

if ( '' !== $atts['parent'] ) {
$product_categories = wp_list_filter( $product_categories, array(
'parent' => $atts['parent'],
) );
}

if ( $hide_empty ) {
foreach ( $product_categories as $key => $category ) {
if ( 0 === $category->count ) {
unset( $product_categories[ $key ] );
}
}
}

$atts['limit'] = '-1' === $atts['limit'] ? null : intval( $atts['limit'] );
if ( $atts['limit'] ) {
$product_categories = array_slice( $product_categories, 0, $atts['limit'] );
}

$columns = absint( $atts['columns'] );
$woocommerce_loop['columns'] = $columns;

ob_start();

if ( $product_categories ) {
woocommerce_product_loop_start();

foreach ( $product_categories as $category ) {
wc_get_template( 'content-product_cat.php', array(
'category' => $category,
) );
}

woocommerce_product_loop_end();
}

woocommerce_reset_loop();

return '<div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>';
}

1

Решение

Вы можете использовать следующий код jQuery:

<script>
jQuery( document ).ready(function() {
var proUL = jQuery( ".products" );
if ( proUL.parent().is( "div" ) ) {
jQuery( ".products" ).unwrap();
}
});
</script>
0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector