Skip to content

Instantly share code, notes, and snippets.

@fobos98
fobos98 / functions.php
Last active November 28, 2018 08:49
kama_breadcrumbs
<!-- BREADCRUMBS -->
<?php
if( function_exists('kama_breadcrumbs') ) kama_breadcrumbs('', array(),
array(
'on_front_page' => false,
)
);
?>
<!-- BREADCRUMBS -->
@fobos98
fobos98 / SmoothScroll.js
Created April 13, 2018 13:13
SmoothScroll
//SmoothScroll
SmoothScroll({
stepSize: 60,
animationTime: 500,
});
//SmoothScroll
@fobos98
fobos98 / menu-anchor.js
Created March 27, 2018 11:52
menu anchor navigation
$("nav").on("click","a", function (event) {
//отменяем стандартную обработку нажатия по ссылке
event.preventDefault();
//забираем идентификатор бока с атрибута href
var id = $(this).attr('href'),
//узнаем высоту от начала страницы до блока на который ссылается якорь
top = $(id).offset().top;
//анимируем переход на расстояние - top за 1500 мс
@fobos98
fobos98 / mfp
Created March 23, 2018 12:44
magnific popup
$('.open-popup-link').magnificPopup({
type:'inline',
removalDelay: 300,
mainClass: "mfp-fade",
fixedContentPos: true,
fixedBgPos: true,
overflowY: 'scroll',
callbacks: {
open: function() {
$('.scroll-to-top').hide();
@fobos98
fobos98 / functions.php
Last active July 19, 2018 11:47
wp debug tools
//DEBUG
$whitelist = array(
'127.0.0.1',
);
if(in_array($_SERVER['REMOTE_ADDR'], $whitelist)){
function vardump($var) {
echo '<pre>';
var_dump($var);
@fobos98
fobos98 / functions.php
Created December 14, 2017 10:52
wp show used template name
//Какой используется файл шаблона?
add_action('wp_head', 'show_template'); // перед шапкой
// add_action('wp_footer', 'show_template'); // в подвале
function show_template(){
global $template;
echo $template;
}
@fobos98
fobos98 / functions.php
Created December 14, 2017 09:44
wp-function add rel: nofollow noopener noreferrer to link
function true_wp_posts_nofollow_callback($matches){
$a = $matches[0];
$site_url = site_url();
if (strpos($a, 'rel') === false){
$a = preg_replace("%(href=\S(?!$site_url))%i", 'rel="noopener noreferrer nofollow" $1', $a);
} elseif (preg_match("%href=\S(?!$site_url)%i", $a)){
$a = preg_replace('/rel=S(?!nofollow)\S*/i', 'rel="noopener noreferrer nofollow"', $a);
}
return $a;
.button
display: inline-block
border: none
color: #fff
text-decoration: none
background-color: $accent
padding: 15px 45px
font-size: 13px
text-transform:
font-weight: 600
@fobos98
fobos98 / robots.txt
Last active September 8, 2017 07:54
robots wp
User-agent: *
Disallow: /cgi-bin # классика...
Disallow: /? # все параметры запроса на главной
Disallow: /wp- # все файлы WP: /wp-json/, /wp-includes, /wp-content/plugins
Disallow: *?s= # поиск
Disallow: *&s= # поиск
Disallow: /search # поиск
Disallow: /author/ # архив автора
Disallow: *?attachment_id= # страница вложения. Вообще-то на ней редирект...
@fobos98
fobos98 / .htaccess
Created September 7, 2017 07:55
htaccess
Options All -ExecCGI -Indexes -Includes +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^black-web
RewriteRule (.*) http://www.black-web.ru/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.black-web.ru/ [R=301,L]
</IfModule>