Viewing File: /home/maglabs/multicerame/wp-content/themes/dom-child/functions.php
<?php
/**
* Child-Theme functions and definitions
*/
// Load rtl.css because it is not autoloaded from the child theme
if ( ! function_exists( 'dom_child_load_rtl' ) ) {
add_filter( 'wp_enqueue_scripts', 'dom_child_load_rtl', 3000 );
function dom_child_load_rtl() {
if ( is_rtl() ) {
wp_enqueue_style( 'dom-style-rtl', get_template_directory_uri() . '/rtl.css' );
}
}
}
add_action('woocommerce_product_query', function($query) {
if (is_admin() || !$query->is_main_query()) return;
$tax_query = [];
if (!empty($_GET['filter'])) {
foreach ($_GET['filter'] as $taxonomy => $term_slug) {
if (taxonomy_exists($taxonomy)) {
$tax_query[] = [
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => sanitize_text_field($term_slug)
];
}
}
}
if (!empty($tax_query)) {
$tax_query['relation'] = 'AND';
$query->set('tax_query', $tax_query);
}
});
?>
Back to Directory
File Manager