Skip to content

Instantly share code, notes, and snippets.

View yxod's full-sized avatar
💭
Ehhhh… ¯\_(ツ)_/¯

yxod

💭
Ehhhh… ¯\_(ツ)_/¯
View GitHub Profile
@yxod
yxod / .htaccess
Created December 3, 2018 07:05
ssl 301
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
@yxod
yxod / .htaccess 5
Created December 3, 2018 14:37
index.php and index.html redirect
#в случае index.php:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://VASHSITE/ [R=301,L]
#в случае index.html:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://VASHSITE/ [R=301,L]
@yxod
yxod / breadcrums opecnart 2
Created May 29, 2019 06:07
breadcrumbs with schema.org
<ul class="breadcrumb container" itemscope itemtype="http://schema.org/BreadcrumbList">
<?php foreach ($breadcrumbs as $i=> $breadcrumb) { ?>
<?php if($i==0) { ?><li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="<?php echo $breadcrumb['href']; ?>" itemprop="item"><span itemprop="name"> <?php echo $breadcrumb['text'];?></span></a><meta itemprop="position" content="<?php echo $i+1; ?>" ></li><?php } elseif($i+1<count($breadcrumbs)) { ?>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="<?php echo $breadcrumb['href']; ?>" itemprop="item"><span itemprop="name">
<?php echo $breadcrumb['text']; ?></span></a><meta itemprop="position" content="<?php echo $i+1; ?>" ></li><?php } else { ?><li><?php echo $breadcrumb['text']; ?></li><?php } ?>
<?php } ?>
</ul>
@yxod
yxod / product microdata opencart 2
Created May 29, 2019 06:09
product microdata opencart 2
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Product",
<?php if ($count_of_reviews > 0) { ?>
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "<?php echo $rating; ?>",
"reviewCount": "<?php echo $count_of_reviews; ?>"
},
@yxod
yxod / robots.txt
Created July 10, 2019 05:14
dissallow
User-agent: *
Disallow: /
<?php if(ICL_LANGUAGE_CODE=='ru'): ?>
<!- Some text ->
<?php elseif(ICL_LANGUAGE_CODE=='ua'): ?>
<!- Some text ->
<?php elseif(ICL_LANGUAGE_CODE=='en'): ?>
<!- Some text ->
<?php endif; ?>
<?php
/*
Template Name: Шаблон:
*/
?>
<?php get_header(); ?>
<?php get_footer(); ?>
RewriteEngine On
RewriteCond %{HTTP_HOST} domain1.ua
RewriteRule (.*) http://domain2.ua/$1 [R=301,L]
@yxod
yxod / gist:eae52bdfeb10e605623065ce8735f06c
Created November 3, 2020 12:30
Remove canonical from singular custom post types
function remove_canonical() {
if ( is_singular( 'voprosy' ) || is_singular( 'filialy') || is_singular( 'uslugi' ) ){
add_filter( 'wpseo_canonical', '__return_false', 10, 1 );
}
}
add_action('wp', 'remove_canonical');