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 / 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 / !readme.md
Last active March 22, 2019 17:00
ST3 sync settings

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

/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs
<?php
$tags = get_tags();
if ($tags) {
foreach ($tags as $tag) {
echo '<p>Tag: <a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> </p> ';
}
}
?>
<?php
//Аякс отправка форм
//Документация: http://api.jquery.com/jquery.ajax/
$("#form, #form2").submit(function(e) {
e.preventDefault;
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize()
}).done(function() {
alert("Спасибо за заявку!");
<?php
$idObj = get_category_by_slug('s_about');
$id = $idObj->term_id;
echo get_cat_name($id);
?>
или
<?php
$idObj = get_category_by_slug('sto_section');
//In Template
<?php
$options = get_option('sample_theme_options');
echo $options['phone1'];
?>
//in functions.php
require_once ( get_stylesheet_directory() . '/theme-options.php' );
<?php
$post = $wp_query->post;
if (in_category('cat_label_1')) {
include(TEMPLATEPATH.'/single-cat_label_1.php');
} elseif (in_category('cat_label_2')) {
include(TEMPLATEPATH.'/single-cat_label_2.php');
}
?>