Фронт

Add dynamic schema product, aggregate Rating to WooCommerce products

$raiting = wp_count_posts()->publish + 112; if($raiting==»») {return;} global $product; $img = wp_get_attachment_url( get_post_thumbnail_id($post_id), ‘thumbnail’ ); if($img==»») {$img = ‘/wp-content/uploads/2024/05/share.jpg’ ;} $title = $product->name; $descr =the_content(); $url = get_permalink(); $reviewCnt = round($raiting / 4); echo ‘ <script type=»application/ld+json»> { «@context»: «http://schema.org/», «@type»: «product», «name»: «‘ . $title . ‘», «brand»: «…», «image»: «‘ . $img . […]

Add dynamic schema product, aggregate Rating to WooCommerce products Читать далее »

Hide woocommerce zero price product and related products wiget

function hide_zero_price_products( $query ) { if ( is_woocommerce() && $query->is_main_query() ) { $query->set( ‘meta_query’, array( array( ‘key’ => ‘_regular_price’, ‘compare’ => ‘>’, ‘value’ => 0, ), ) ); } } add_action( ‘woocommerce_product_query’, ‘hide_zero_price_products’ ); add_filter( ‘woocommerce_related_products_args’, function( $args ) { unset( $args[‘post__in’] ); $args[‘meta_query’] = array( ‘key’ => ‘_regular_price’, ‘compare’ => ‘>’, ‘value’ => 0,

Hide woocommerce zero price product and related products wiget Читать далее »

Прокрутить вверх