This file contains 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 = ''; |
This file contains 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
// Method #1 | |
var num = 1234567890; | |
var result = num.toLocaleString(); // or .toLocaleString('ru'); | |
console.log(result); | |
// Method #2 | |
function numberWithSpaces(x) { | |
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " "); | |
} | |
console.log(numberWithSpaces(100)); |
This file contains 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 setDefaultHrefImage() { | |
wp_enqueue_script( | |
'modify-image-link-destination-default', | |
get_template_directory_uri() . '/js/setDefaultHrefImage.js', | |
array('wp-hooks') | |
); | |
} | |
add_action('enqueue_block_editor_assets', 'setDefaultHrefImage'); |
This file contains 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
<!-- GoogleAnalytics counter --> | |
<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-54873391-1', 'auto'); | |
ga('send', 'pageview'); | |
setTimeout("ga('send', 'event', '15 seconds', 'read')",15000); |
This file contains 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
<button class="btn btn__toggle"> | |
<svg class="ham" viewBox="0 0 100 100" onclick="this.classList.toggle('active')"> | |
<path class="ham__line top" d="m 70,33 h -40 c 0,0 -6,1.368796 -6,8.5 0,7.131204 6,8.5013 6,8.5013 l 20,-0.0013" /> | |
<path class="ham__line middle" d="m 70,50 h -40" /> | |
<path class="ham__line bottom" d="m 69.575405,67.073826 h -40 c -5.592752,0 -6.873604,-9.348582 1.371031,-9.348582 8.244634,0 19.053564,21.797129 19.053564,12.274756 l 0,-40" /> | |
</svg> | |
</button> |
This file contains 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_robots', 'yoast_seo_robots_change' ); | |
function yoast_seo_robots_change( $robots ) { | |
if (is_page(1496) || is_page(1496) ) { | |
$robots = "noindex, nofollow"; | |
return $robots; | |
} | |
return $robots; | |
} |
This file contains 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
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_URI} !(.*)/$ | |
RewriteCond %{REQUEST_URI} !^/wp-json | |
RewriteCond %{REQUEST_URI} !.xml$ | |
RewriteRule ^(.*[^/])$ $1/ [L,R=301] |
This file contains 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 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
RewriteCond %{THE_REQUEST} \ (.*)//+ | |
RewriteRule (.*) https://www.kaper.pro/$1 [R=301,L] |
This file contains 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 )]); | |
} |
NewerOlder