$(window).on('resize', function(e){
// Переменная, по которой узнаем запущен слайдер или нет.
var initLib = $('.library-slider').data('init-slider');
if(window.innerWidth < 768){
// Если слайдер не запущен
if(initLib != 1){
// Запускаем слайдер и записываем в data init-slider = 1
$('.library-slider').slick({
arrows: false,
dots: true,
slidesToShow: 3,
slidesToScroll: 1,
responsive: [
{
breakpoint: 576,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
}
}
]
}).data({'init-slider': 1});
}
}
// Если десктоп
else {
// Если слайдер запущен
if(initLib == 1){
// Разрушаем слайдер и записываем в data init-slider = 0
$('.library-slider').slick('unslick').data({'init-slider': 0});
}
}
}).trigger('resize')
// Move jQuery to the footer
function theme_move_jquery_to_footer() {
wp_scripts()->add_data( 'jquery', 'group', 1 );
wp_scripts()->add_data( 'jquery-core', 'group', 1 );
wp_scripts()->add_data( 'jquery-migrate', 'group', 1 );
}
add_action( 'wp_enqueue_scripts', 'theme_move_jquery_to_footer' );
// Enqueue scripts and styles.
function theme_scripts() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.min.js' ), false, NULL, true );
wp_enqueue_script( 'jquery' );
}
add_action( 'wp_enqueue_scripts', 'theme_scripts' );
function add_taxonomies_to_pages() {
register_taxonomy_for_object_type( 'post_tag', 'page' );
register_taxonomy_for_object_type( 'category', 'page' );
}
add_action( 'init', 'add_taxonomies_to_pages' );
if ( ! is_admin() ) {
add_action( 'pre_get_posts', 'category_and_tag_archives' );
}
function category_and_tag_archives( $wp_query ) {
$my_post_array = array('post','page');
if ( $wp_query->get( 'category_name' ) || $wp_query->get( 'cat' ) )
$wp_query->set( 'post_type', $my_post_array );
if ( $wp_query->get( 'tag' ) )
$wp_query->set( 'post_type', $my_post_array );
}
add_action( 'woocommerce_after_shop_loop_item_title', 'custom_show_product_cat', 7 );
function custom_show_product_cat() {
global $product;
echo wc_get_product_category_list( $product->get_id(), ', ', '<div class="product-cat">' . _n( 'Category:', 'Categories:', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</div>' );
}
add_filter('wpcf7_autop_or_not', '__return_false');
<div class="form-group">[text* contact-name id:contact-name class:form-control class:input-text]<label for="contact-name">Name</label></div>
<div class="form-group">[email* contact-email id:contact-email class:form-control class:input-text]<label for="contact-email">Email</label></div>
<div class="form-group">[textarea contact-message x2 id:contact-message class:form-control class:input-text]<label for="contact-message">Message</label></div>
<div class="form-submit">[submit class:gradient-btn class:btn-submit "Send Message"]</div>
.contact-form-wrapper .wpcf7 .form-group > label {
position: absolute;
top: 20px;
left: 0;
cursor: text;
pointer-events: none;
margin-bottom: 0;
-webkit-transition: all 0.25s;
transition: all 0.25s;
}
.contact-form-wrapper .wpcf7 .form-group.active > label {
top: -5px;
left: 2px;
font-size: 16px;
cursor: default;
}
function x_theme__remove_name_cat( $title ){
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
}
return $title;
}
add_filter( 'get_the_archive_title', 'x_theme__remove_name_cat' );
function wpq_after_subcategory( $category ) {
$queried_object = get_queried_object();
if( is_product_category() && $queried_object->parent !== 0 ){
if ( function_exists( 'wpq_get_min_price_per_product_cat' ) ) {
echo 'от ' . wpq_get_min_price_per_product_cat( $category->term_id ) . ' ₽/м2';
}
}
}
add_action( 'woocommerce_after_subcategory', 'wpq_after_subcategory' );