Skip to content

Instantly share code, notes, and snippets.

View RiodeJaneiroo's full-sized avatar
🎯
Focusing

Vadim Zmiievskyi RiodeJaneiroo

🎯
Focusing
  • Ukraine
View GitHub Profile
@RiodeJaneiroo
RiodeJaneiroo / category.php
Last active May 3, 2024 12:52
[Opencart filter Mega Pro] #seo #pattern #opencart #filter #megaPro #Mega Filter PRO
<?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 = '';
@RiodeJaneiroo
RiodeJaneiroo / method1.js
Last active March 15, 2023 17:30
[Разбить число на разряды JS] #js #javascript #number
// 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));
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active January 31, 2023 13:12
[Wordpress Default link image media] in Gutenberg set default in image link media #wp #wordpress #gutenberg
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');
@RiodeJaneiroo
RiodeJaneiroo / index.html
Last active May 5, 2021 15:45
[Google Analitics] #google_analitics
<!-- 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);
@RiodeJaneiroo
RiodeJaneiroo / index.html
Created January 9, 2021 13:50
[Hambureger menu SVG] #css
<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>
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Created June 16, 2020 10:54
[Yoast change meta tag robots for page] #php #seo #yoast
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;
}
@RiodeJaneiroo
RiodeJaneiroo / .htaccess
Created June 14, 2020 14:30
[Редирект без слеша на слеш] #slash #seo #php
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond %{REQUEST_URI} !^/wp-json
RewriteCond %{REQUEST_URI} !.xml$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active June 11, 2020 13:40
[Wordpress SEO redirect from any symbol ] 301 redirect from wrong url #seo #yoast #wordpress #redirect
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' );
@RiodeJaneiroo
RiodeJaneiroo / .htaccess
Last active April 20, 2020 13:53
[Wordpress SEO URL few slash/slesh] redirect from multiple sleshes to one #seo #wordpress #redirect #htaccess #php
RewriteCond %{THE_REQUEST} \ (.*)//+
RewriteRule (.*) https://www.kaper.pro/$1 [R=301,L]
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active February 3, 2020 09:11
[Разметка для хлебных крошек] #wordpress #seo #breadcrumbs
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 )]);
}