Skip to content

Instantly share code, notes, and snippets.

@Scordavis
Scordavis / noindex_img_desc.php
Created February 5, 2019 18:06 — forked from amorkovin/noindex_img_desc.php
Закрыть подписи к изображениям от индексации в WordPress
add_filter( 'the_content', 'morkovin_add_noindex_img_cap', 1000 );
function morkovin_add_noindex_img_cap( $content ) {
$pattern = "/<p class=\"wp-caption-text\">([^<]+)<\/p>/i";
$replacement = "<!--noindex--><p class=\"wp-caption-text\">$1</p><!--/noindex-->";
$content = preg_replace($pattern, $replacement, $content);
$pattern = "/<div class=\"wp-caption-text\">([^<]+)<\/div>/i";
$replacement = "<!--noindex--><div class=\"wp-caption-text\">$1</div><!--/noindex-->";
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
@Scordavis
Scordavis / js
Last active November 2, 2018 17:48
jQuery Bootstrap 3 web browser grid. Must be added in html body after jquery link.
/* Visual Bootstrap 3 grid by PixelSPB, v. 1.0b В© 2018, All rights reserved */
jQuery(document).ready(function($) {
var cols = 12; // numCols
$('head').append('<style>.showHideVisualGrid{display:none;}\n.pixelGridShowHide input[type="checkbox"] {margin: 0; width: auto !important; height: auto !important; margin-right: 10px !important;}\n.pixelVisualGrid{top:0; bottom:0; left:0; right:0; z-index:9997; display:none; position:fixed;}\n.pixelVisualGrid.showVisualGrid{display:block;}\n.v100{height: 100vh;}\n.pixelVisualGrid .visualGridContentZone{background:#ffb600;}\n.pixelVisualGrid .colWhiteSpace{background:#ebebeb; opacity:0.3;}\n.pixelVisualGrid .colWhiteSpace.transparentWhiteSpace{background:transparent;}\n.pixelGridColNumHide{display:none;}\n.pixelVisualGrid.grayscale .visualGridContentZone{background:#bfbfbf}\n.showHideVisualGrid{position:fixed; top:0; right:0; z-index:9998; padding:20px; background:#fff; border-radius: 0 0 0 10px;}\n.pixelGridShow{width:30px; height:30px; position:fixed; z-index:9
@Scordavis
Scordavis / ssl-notwww-to-www.txt
Created November 1, 2018 20:26 — forked from amorkovin/ssl-notwww-to-www.txt
www и ssl редиректы для htaccess
-------С www на не-www-------
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www.sdelaysite\.com$ [NC]
RewriteRule ^(.*)$ https://sdelaysite.com/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://sdelaysite.com/$1 [R=301,L]
@Scordavis
Scordavis / robots.txt
Created November 1, 2018 13:37 — forked from amorkovin/robots.txt
robots.txt
User-agent: Yandex
Disallow: /wp-admin
Disallow: /wp-includes
Allow: /wp-includes/js/*
Disallow: /wp-login.php
Disallow: /wp-register.php
Disallow: /xmlrpc.php
Disallow: *?s*
Disallow: *?preview=true*
Disallow: */trackback/
@Scordavis
Scordavis / css
Created October 23, 2018 10:10
Custom-reset.css (By Roman Yurchenko @yurch-html)
/* custom-reset.css | 27.08.2018 | https://yurch-html.github.io/dist/custom-reset.html */
*,
*:before,
*:after {
box-sizing: inherit;
}
html {
box-sizing: border-box;
@Scordavis
Scordavis / !readme.md
Last active March 22, 2019 17:00
ST3 sync settings

Синхронизация настроек Sublime Text 3 e02de7830ee606bb0e8fe915387089b2c7d581ec токен

@Scordavis
Scordavis / gist:7fd08da7471245f5459c9f7d41d42241
Created December 17, 2017 20:33
Wordpress убираем WPAUTOP
1) Находим в проекте wordpress файл, который называется formatting.php (должен лежать в папке wp-includes)
2) В этом файле находим функцию, которая называется wpautop
3) Там находим переменную $allblocks (188 строка должна быть)
4) Туда дописываем img
5) PROFIT!
@Scordavis
Scordavis / php
Created December 16, 2017 17:08
Вывод дочерних рубрик с записями АККОРДЕОН (brewer.com)
<main class="container-fluid main-section dark pattern" id="brewers" style="background-image: url(<?php echo the_field ('patternbg', 80); ?>);">
<section class="container">
<img src="<?php echo the_field ('lightvensel', 80); ?>" alt="" class="divider">
<h2 class="seo-page-title"><?php echo get_the_title() ?></h2>
<p class="seo-page-description"><?php echo get_the_excerpt( ) ?></p>
</section>
<?php
$categories = get_categories(['parent' => 9,]);
@Scordavis
Scordavis / php
Created December 13, 2017 08:39
WordPress КОРРЕКТНЫЙ вызов записей из категории
<?php
$id=4; // ID заданной рубрики
$n=5; // количество выводимых записей
$recent = new WP_Query("cat=$id&showposts=$n");
while($recent->have_posts()) : $recent->the_post();
?>
<div>
...
</div>
@Scordavis
Scordavis / JavaScript
Created December 10, 2017 09:49
Переключение вкладки tab в Bootstrap при переходе с внешней ссылки (другой страницы). Switch tab on Bootstrap tabs by clicking on externa
// Javascript to enable link to tab
var url = document.location.toString();
if (url.match('#')) {
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
}
// Change hash for page-reload
$('.nav-tabs a').on('shown.bs.tab', function (e) {
window.location.hash = e.target.hash;
})