Skip to content

Instantly share code, notes, and snippets.

View Nabozhev's full-sized avatar
🎓
Researching knowledge

Dmitry Nabozhev

🎓
Researching knowledge
View GitHub Profile
@Nabozhev
Nabozhev / menuBootsrap
Created December 5, 2023 19:33
доавление меню многоуровневого в вордпресс
Выпадающие n-уровневые меню в Wordpress.
1) в functions.php
<?php
/**
* Extended Walker class for use with the
* Twitter Bootstrap toolkit Dropdown menus in Wordpress.
* Edited to support n-levels submenu.
* @author johnmegahan https://gist.github.com/1597994, Emanuele 'Tex' Tessore https://gist.github.com/3765640
@Nabozhev
Nabozhev / index.html
Created December 3, 2023 19:51
шапка сайта взять отсюда
<header class="container">
<div class="right_block_top flex columns-6">
<a href="mailto:info@uptkprogress.ru">info@uptkprogress.ru</a>
<a href="tel:+7 (3435) 21-21-60">+7 (3435) 21-21-60</a>
<a href="tel:+7 (3435) 47-84-00">+7 (3435) 47-84-00 </a>
</div>
</header>
@Nabozhev
Nabozhev / single.php
Created April 25, 2021 20:48
Вывод похожих на текущую постов по меткам wordpress
<div class="ra-list">
<?php
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
'tag__in' => $tag_ids, // Сортировка происходит по тегам (меткам)
'orderby'=>rand, // Добавляем условие сортировки рандом (случайный подбор)
'caller_get_posts'=>1, // Запрещаем повторение ссылок
@Nabozhev
Nabozhev / index.php
Created April 10, 2021 22:18
Ограничить количество постов в цикле (добавить перед основным циклом)
<?php query_posts('posts_per_page=3'); ?>
@Nabozhev
Nabozhev / определение координат курсора мыши
Created March 27, 2021 20:08
определение курсора координат мыши
const body = document.querySelector('body')
let cx = window.innerWidth / 2,
cy = window.innerHeight / 2
body.addEventListener('mousemove', e => {
let clientX = e.pageX
let clientY = e.pageY
console.log(e.pageX + ' / ' + e.pageY)
@Nabozhev
Nabozhev / main.sass
Created March 20, 2021 17:17
Скрыть webkit крестик с поля поиска input search
input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-results-button,
input[type='search']::-webkit-search-results-decoration
display: none
condition
@Nabozhev
Nabozhev / app.js
Created March 18, 2021 19:12
Выполнение скрипта при загрузке страницы
$(document).ready(function() {
// executes when HTML-Document is loaded and DOM is ready
if(document.documentElement.clientWidth < 768) {
$('.main-content').after($('.nav-inner'));
console.log('менее 768px')
} else {
$('.menu-adaptive').after($('.nav-inner'));
console.log('режим отображения более 768px')
}
});
@Nabozhev
Nabozhev / common.js
Created June 6, 2019 20:31
Передача параметра по ссылке jquery
//проверяет на наличие в адресе метки и килкает на нужную ссылку
$(document).ready(function () {
if (window.location.href.indexOf("tehnology") > -1) {
console.log("Нужно перейти на технологии");
$('.main_nav li:nth-child(1) a').trigger('click');
}
});
@Nabozhev
Nabozhev / common.js
Created May 15, 2019 15:29
Предварительная загрузка изображений в кэш
pic = new Image();
pic2 = new Image();
pic3 = new Image();
pic4 = new Image();
pic5 = new Image();
pic6 = new Image();
pic7 = new Image();
pic8 = new Image();
pic.src = "../img/header_bg_1.jpg";
pic2.src = "../img/header_bg_2.jpg";