Skip to content

Instantly share code, notes, and snippets.

View seojacky's full-sized avatar

Eugen seojacky

View GitHub Profile
@seojacky
seojacky / author.html
Created September 5, 2021 15:24
Пример микроразметки https://schema.org/Person для блока "Автор" на странице
//Пример микроразметки https://schema.org/Person для блока "Автор" на странице
//© Калинский Евгений aka seojacky (https://t.me/big_jacky)
<div itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<link itemprop="url" href="https://site.ru/author/maxim/">
<img alt="Макс" src="https://site.ru/maks-shelest.jpg" height="100" width="100">
<a href="https://site.ru/author/maxim/" itemprop="name">Максим</a>
<!-- всё что ниже - по желанию -->
@seojacky
seojacky / comment-form-validation.js
Last active August 29, 2021 00:11
Проверяет текст комментария на минимальную длину
document.addEventListener( "DOMContentLoaded", function( event ) {
var minLength = 20; // set for how many characters
var targetTextarea = document.querySelector( ".comment-form-comment textarea" );
var charsNotification = document.querySelector( ".comment-notes" );
var addedElement = document.createElement('span');
addedElement.className = 'comment-notification';
addedElement.style.cssText = 'color:red;background-color:yellow';
addedElement.appendChild(document.createTextNode(''));
charsNotification.appendChild(addedElement);
@seojacky
seojacky / my-shortcode-function.php
Created August 15, 2021 11:36
Шорткод курса валют WordPress
function my_shortcode_function($atts) {
extract(shortcode_atts(array(
"summ" => 'укажите параметр summ (в батах)',
"currency" => 'укажите параметр currency (USD, RUR)'
), $atts));
// Путь к файлу c курсами
//$file_course_of_exchange = "https://site.ru/wp-content/themes/yume-child/data.txt";
@keyframes big-show{0%{opacity: 0}100%{opacity: 1}}@keyframes hidden{0%{opacity: 0}99%{opacity: 0}100%{opacity: 1}}@keyframes dark{0%{opacity: 0}100%{opacity: 0.7}}.picture-big{position: fixed;top: 40px;left: 20px;right: 20px;bottom: 40px;background-repeat: no-repeat;background-size: contain;background-position: center;animation: big-show 1s;z-index: 99999}.picture-big-mobile{left: 5px;right: 5px;top: 5px;bottom: 5px}.popup-open,[data-popup="true"]{cursor: zoom-in}.till-popup-close{
position: absolute;
font-size: 3rem;
cursor: pointer;
font-weight: 600;
color: white;
line-height: 1;
text-align: center;
right: 1rem;
width: 3rem;
add_action('template_redirect', function () {
ob_start(function ($buffer) {
global $wpco_html;
$buffer = str_replace('<source', '<source class="mihdan-lozad" ', $buffer);
return $buffer;
});
});
<?php
$id = '7QU1nvuxaMA';
$json = file_get_contents("https://www.youtube.com/oembed?url=youtube.com/watch?v=".$id."&format=json");
//var_dump(json_decode($json));
//var_dump(json_decode($json, true));
$obj = json_decode($json);
print "<b>title:</b> ". $obj->{'title'} ."<br>";
print "<b>author_name:</b> ". $obj->{'author_name'} ."<br>";
<div id="watch7-content" class="watch-main-col" itemscope="" itemid="" itemtype="http://schema.org/VideoObject">
<link itemprop="url" href="https://www.youtube.com/watch?v=SSesEP5-9rM">
<meta itemprop="name" content="Плагин для микроразметки видео с YouTube по Schema.org #wordpress">
<meta itemprop="description" content="Инструкция по использованию плагина для разметки по Schema.org видероликов с YouTubeСильно упрощает сам процесс разметки не требуется никаких знаний хтмл или...">
<meta itemprop="paid" content="False">
<meta itemprop="channelId" content="UCml9k9gl6NwWxsqHQwLQ6fQ">
<meta itemprop="videoId" content="SSesEP5-9rM">
<meta itemprop="duration" content="PT6M50S">
<meta itemprop="unlisted" content="False">
<span itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<?php
/* этот код удаляет type="text/javascript"
и пустые строки в исходном коде
Вопрос: Как в зависимости от настроек $remove_type_text_javascript_css и $remove_empty_string вкл/выкл опции?
Конструкция if внутри ob_start(function ($buffer) не работает
*/
$remove_type_text_javascript_css = true;
$remove_empty_string = false;
"function"==typeof jQuery&&jQuery(document).ready(function(a){a("body").on("post-load",function(){window.a2a&&a2a.init_all()})});
@seojacky
seojacky / noindex-seo.php
Last active October 26, 2020 11:34
noindex SEO
<?php
/*
Другие плагины для добавления <meta name="robots" content="noindex" />:
Этот плагин https://wordpress.org/plugins/noindex-seo/
Easy Noindex And Nofollow https://wordpress.org/plugins/easy-noindex-and-nofollow/
- noindex для Search Page, Category Page
Noindex Pages https://wordpress.org/plugins/noindex-pages/