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
| 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
| 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
| 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_filter( 'wpseo_title', 'add_paged_title_category_wc' ); | |
| function add_paged_title_category_wc($title) { | |
| $paged = get_query_var('paged') ? get_query_var('paged') : 1; | |
| if ( is_tax('product_cat') && $paged > 1) { | |
| $newTitle = 'Страница '.$paged.', '. $title; | |
| return $newTitle; | |
| } | |
| } | |
| add_filter( 'wpseo_metadesc', 'add_paged_descr_category_wc' ); | |
| function add_paged_descr_category_wc($descr) { |
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
| // Изменяем атрибут class у тега li | |
| add_filter( 'nav_menu_css_class', 'filter_nav_menu_css_classes', 10, 4 ); | |
| function filter_nav_menu_css_classes( $classes, $item, $args, $depth ) { | |
| if ( $args->theme_location === 'header_menu' ) { | |
| if($depth == 1) { | |
| $classes = ['header-podmenu_list']; | |
| } else { | |
| $classes = ['header-menu_list']; | |
| } | |
| if ( $item->current ) { |
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( 'wp_get_attachment_image_attributes', 'add_title_attachment_image', 10, 3 ); | |
| function add_title_attachment_image( $attr, $attachment, $size ){ | |
| if(empty($attr['title'])) $attr['title'] = $attr['alt']; | |
| return $attr; | |
| } | |
| function add_alt_tags($content) | |
| { | |
| global $post; | |
| preg_match_all('/<img (.*?)\/>/', $content, $images); |
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 wpml_url_fix( $languages ) { | |
| // make your changes to the $languages array here. | |
| if($languages['ru']['url'] == site_url()."/sitemap") { | |
| $languages['ru']['url'] = site_url()."/sitemap.html"; | |
| } | |
| if($languages['ua']['url'] == site_url()."/ua/sitemapua") { | |
| $languages['ua']['url'] = site_url()."/ua/sitemap.html"; | |
| } | |
| return $languages; |
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
| jQuery(document).on('click',function (e) { | |
| var el = '.element'; | |
| if (jQuery(e.target).closest(el).length) return; | |
| // дальше пишем код который нужно выполнить по клику вне элемента | |
| }); |
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
| $acfParent = acf_add_options_page(array( | |
| 'page_title' => 'Основные настройки темы', | |
| 'menu_title' => 'Настройка темы', | |
| 'menu_slug' => 'theme-general-settings', | |
| 'capability' => 'edit_posts', | |
| 'redirect' => false | |
| )); | |
| $acfChild = acf_add_options_sub_page(array( | |
| 'page_title' => 'Скрипты', | |
| 'menu_title' => 'Скрипты', |