Answer the question
In order to leave comments, you need to log in
Problem with woocommerce Has_cap function called with an argument deprecated as of version 2.0.0?
Guys, tell me how to redo the code. I make the display of goods in a list, I added
this code to function.php:
add_action('woocommerce_before_shop_loop', 'setTempleteCategory');
/**
* Устанавливает режим просмотра категорий товаров
* @global type $VIEW_TEMPLATE
*/
function setTempleteCategory() {
global $VIEW_TEMPLATE;
if (isset($_REQUEST['cat_templete'])) {
if ($_REQUEST['cat_templete'] == 'list') {
$VIEW_TEMPLATE = 'list';
setcookie("view_template_product", "", time() - 3600);
setcookie('view_template_product', 'list', time() + 60 * 60 * 24 * 30);
} elseif ($_REQUEST['cat_templete'] == 'table') {
$VIEW_TEMPLATE = 'table';
setcookie("view_template_product", "", time() - 3600);
setcookie('view_template_product', 'table', time() + 60 * 60 * 24 * 30);
} else {
$VIEW_TEMPLATE = 'table';
}
} else {
if (isset($_COOKIE['view_template_product'])) {
if ($_COOKIE['view_template_product'] == 'list') {
$VIEW_TEMPLATE = 'list';
} elseif ($_COOKIE['view_template_product'] == 'table') {
$VIEW_TEMPLATE = 'table';
}
} else {
$VIEW_TEMPLATE = 'table';
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question