Skip to content

Instantly share code, notes, and snippets.

Scordavis

Block or report user

Report or block Scordavis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Scordavis
Scordavis / noindex_img_desc.php
Created Feb 5, 2019 — forked from amorkovin/noindex_img_desc.php
Закрыть подписи к изображениям от индексации в WordPress
View noindex_img_desc.php
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 Nov 2, 2018
jQuery Bootstrap 3 web browser grid. Must be added in html body after jquery link.
View js
/* 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 Nov 1, 2018 — forked from amorkovin/ssl-notwww-to-www.txt
www и ssl редиректы для htaccess
View ssl-notwww-to-www.txt
-------С 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]
View 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 Oct 23, 2018
Custom-reset.css (By Roman Yurchenko @yurch-html)
View css
/* 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 Mar 22, 2019
ST3 sync settings
View !readme.md

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

View gist:7fd08da7471245f5459c9f7d41d42241
1) Находим в проекте wordpress файл, который называется formatting.php (должен лежать в папке wp-includes)
2) В этом файле находим функцию, которая называется wpautop
3) Там находим переменную $allblocks (188 строка должна быть)
4) Туда дописываем img
5) PROFIT!
@Scordavis
Scordavis / php
Created Dec 16, 2017
Вывод дочерних рубрик с записями АККОРДЕОН (brewer.com)
View php
<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 Dec 13, 2017
WordPress КОРРЕКТНЫЙ вызов записей из категории
View php
<?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 Dec 10, 2017
Переключение вкладки tab в Bootstrap при переходе с внешней ссылки (другой страницы). Switch tab on Bootstrap tabs by clicking on externa
View JavaScript
// 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;
})
You can’t perform that action at this time.