<script>
$( document ).ready(function(){
$( "li.product.sale" ).each( function() {
var price_b = $( this ).find(".wc-block-components-product-price del bdi");
var price_before = price_b.text().match(/\d/g).join('');
var price_a = $( this ).find(".wc-block-components-product-price ins bdi");
var price_after = price_a.text().match(/\d/g).join('');
var sel = price_before - price_after;
var prc = Math.round( sel / price_before * 100 );
$( this ).find(".wc-block-grid__product-image > a").prepend('<span class="onsale">-'+ prc +' %</span>');
});
});
</script>
body:not(.admin-bar) img {
-moz-user-select: none !important;
-webkit-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
pointer-events: none !important;
}
<?php
$taxonomy = 'product_cat';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$empty = 0;
$args = array(
'taxonomy' => $taxonomy,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'hide_empty' => $empty
);
$all_categories = get_categories( $args );
foreach ($all_categories as $cat) {
if($cat->category_parent == 0) {
$category_id = $cat->term_id;
echo '<br /><a href="'. get_term_link($cat->slug, 'product_cat') .'">'. $cat->name .'</a>';
$args2 = array(
'taxonomy' => $taxonomy,
'child_of' => 0,
'parent' => $category_id,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'hide_empty' => $empty
);
$sub_cats = get_categories( $args2 );
if($sub_cats) {
foreach($sub_cats as $sub_category) {
echo $sub_category->name ;
}
}
}
}
?>
.icons a {
padding...
}
.icons img {
height...
}
// Карта Яндекс
add_theme_support( 'post-thumbnails' );
function yandex_map_all(){
global $wpdb;
$products = $wpdb->get_results("SELECT ID FROM `ev_posts` WHERE `post_type`='product' AND `post_status`='publish'");
$result = array();
foreach($products as $product){
$result[] = $product->ID;
}
the_multiple_yandex_map($result);
}
function the_multiple_yandex_map($post_ids = array()){
$marks = array(); // Все метки
$marks_counter = 1;
foreach ($post_ids as $post_id) {
$data = (array)json_decode(get_field('halls_mapya', $post_id, false), true); // загрузка меток из записи
if (!isset($data['marks']) || !is_array($data['marks'])) {
continue;
}
foreach ((array)$data['marks'] as $mark) {
$mark['id'] = $marks_counter;
$mark['content'].='<a href="'.get_permalink($post_id).'">'.get_the_title($post_id).'</a>';
$mark['content'].=get_the_post_thumbnail($post_id);
$marks[] = $mark;
$marks_counter++;
}
}
$map_data = (array)json_decode(get_field('halls_mapya', get_the_ID(), false), true); // загрузка параметров карты для вывода всех меток
if(is_product_category('61','75')) {
$map_data = array(
"center_lat" => 59.936803,
"center_lng" => 30.309590,
"zoom" => 12,
"type" => "map"
);
}else{
$map_data = array(
"center_lat" => 55.755456,
"center_lng" => 37.623104,
"zoom" => 10,
"type" => "map"
);
}
$map_data['marks'] = $marks;
the_yandex_map('', false, json_encode($map_data), 450);
}