Skip to content

Instantly share code, notes, and snippets.

View flayder's full-sized avatar
🏠
Working from home

Artem flayder

🏠
Working from home
View GitHub Profile
@flayder
flayder / anchor.js
Created September 5, 2015 08:28
Плавное перемещение к якорю!
$('.btn-button-blue a').click(function() {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') || location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
@flayder
flayder / popup.js
Created September 5, 2015 08:34
Плавное появление popup - который можно убрать при клике на любой участок документа, но не при клике на область popup
$(document).ready(function(){
$('.carousel').carousel();
$('.btn-button-blue a').click(function() {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') || location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
@flayder
flayder / index.php
Created September 5, 2015 10:39
last section
<section id="new-post" class="wow bounceInUp" data-wow-duration="2s" data-wow-delay="1s">
<div class="container">
<div class="title">Свежие публикации</div>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="new-post col-md-6" >
<div class="wrap">
<noindex>
<a rel="nofollow" href="<?php the_permalink(); ?>
">
<?php the_title(); ?></a>
@flayder
flayder / slider.html
Created September 5, 2015 10:45
slider-bootstrap3
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Указатели -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Контент слайда (slider wrap)-->
<div class="carousel-inner">
<div class="item active">
@flayder
flayder / validate email.js
Created September 5, 2015 18:56
Проверка эмайл !
(function () {
var btn = document.getElementById('btn-execution');
reg = /^(\w|[.])+@[a-z]+[.][a-z]{2,3}$/i,
reqSkype = /^\w[a-z]{1,}\d*\w*$/i;
email.addEventListener('keyup', function(){
if (!reg.test(email.value)) {
email.classList.add('error');
btn.setAttribute('disabled', 'disabled');
@flayder
flayder / wordpress
Last active January 16, 2016 08:15
Gid WordPress
- Восстановление стилей, после копирования html кода:
<?php bloginfo("template_directory");?>/
- Вывод заголовков:
<h1,2,3,4,5><?php the_title();?></h1,2,3,4,5>
- Контент:
<?php the_post();?>
<?php the_content();?>
@flayder
flayder / get_post_meta
Last active September 20, 2015 10:27
Вывод произвольных полей поста WP
<?php echo get_post_meta($post->ID, 'name_field', true); ?>
@flayder
flayder / .htaccess
Created September 21, 2015 12:50
url сайта c www, или без
Без www
ReWriteEngine On
RewriteCond %{HTTP_HOST} ^www.myrusakov.ru$ [NC]
RewriteRule ^(.*)$ http://myrusakov.ru/$1 [R=301,L]
С www
ReWriteEngine On
RewriteCond %{HTTP_HOST} ^myrusakov.ru$ [NC]
RewriteRule ^(.*)$ http://www.myrusakov.ru/$1 [R=301,L]
@flayder
flayder / popular_cakes.php
Created September 28, 2015 14:47
Вывод товара woocommerse
@flayder
flayder / post.php
Last active September 29, 2015 09:37
Вывод подкатегорий и записей из родительской категории!
<?php
function productCart() {
?>
<div class="buy-with">
<h2><?php echo get_cat_name(46); ?></h2>
<ul>
<?php
$parent_id = 46;