This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener("DOMContentLoaded", function() { | |
[].forEach.call( document.querySelectorAll('input.wpcf7-tel'), function(input) { | |
var keyCode; | |
function mask(event) { | |
event.keyCode && (keyCode = event.keyCode); | |
var pos = this.selectionStart; | |
if (pos < 3) event.preventDefault(); | |
var matrix = "+7 (___) ___-__-__", | |
i = 0, | |
def = matrix.replace(/\D/g, ""), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_print_styles', 'wps_deregister_styles', 100 ); | |
function wps_deregister_styles() { | |
wp_dequeue_style( 'wp-block-library' ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('pll_translation_url', 'check_archive_translation', 10, 2); | |
function check_archive_translation($url, $lang) { | |
$posSearch = strpos($url, '/sitemap/'); | |
$posSearchUK = strpos($url, 'uk/karta-sajtu/'); | |
if($posSearch !== false) { | |
$url = site_url() . '/sitemap.html'; | |
} else if ($posSearchUK !== false) { | |
$url = site_url() . '/uk/sitemap.html'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function schemaBreadcrumbsJson() { | |
global $post; | |
$arrayBreadcrumbs = array(); | |
$parent_id = ( $post ) ? $post->post_parent : ''; | |
if(is_category()) { // для рубрики | |
$parents = get_ancestors( get_query_var('cat'), 'category' ); | |
foreach ( array_reverse( $parents ) as $cat ) { | |
array_push($arrayBreadcrumbs, [get_cat_name( $cat ), get_category_link( $cat )]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function yourstheme_menu_link_attributes( $args ) { | |
global $wp; | |
$current_url = untrailingslashit(add_query_arg( $_SERVER['QUERY_STRING'], '', home_url( $wp->request ) ) ); | |
$href = untrailingslashit( $args['href']); | |
if($current_url == $href){ | |
$args['href'] = ''; | |
} | |
return $args; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = 'artzm.space'; | |
var url = (!url.match(/^[a-zA-Z]+:\/\//)) ? 'http://' + url : url; | |
// Google Page Speed | |
jQuery.ajax({ | |
url: "https://www.googleapis.com/pagespeedonline/v5/runPagespeed", | |
type: "GET", | |
data: { | |
"strategy": "desktop", // or mobile | |
"fields": "lighthouseResult/categories/*/score", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('woocommerce_dropdown_variation_attribute_options_args', 'my_change_choose_an_option_text_func', 10, 2); | |
function my_change_choose_an_option_text_func($args){ | |
if($args['attribute'] == 'pa_tsvet') { | |
$args['show_option_none'] = 'Выбрать цвет'; | |
} | |
return $args; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="textarea-lineup"><span></span></div> | |
<script> | |
colorScale($('.textarea-lineup'), 10); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wrong_url_redirect($url) { | |
global $wp; | |
if(!get_query_var('paged') && !empty($url) && !is_front_page() && $url != home_url($wp->request . '/' ) && !is_search()) { | |
wp_safe_redirect( $url, 301 ); | |
exit; | |
} | |
return $url; | |
} | |
add_filter( 'wpseo_canonical', 'wrong_url_redirect' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// don't forget: $this->load->model('catalog/manufacturer'); | |
$pageNumber = ''; | |
if (isset($this->request->get['page'])) { | |
$pageNumber = ' - Страница ' . $this->request->get['page']; | |
} | |
if(isset($this->request->get['mfp'])) { // get manufacturer name | |
$filterMega = $this->request->get['mfp']; | |
$filterMegaName = ''; |