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 / gist:6c69c22a0b09a5949182
Created October 12, 2015 13:30
Оптимизация сайта
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="ru"> <!--<![endif]-->
<head>
<meta charset="utf-8">
@flayder
flayder / product-cart-thumb
Created October 3, 2015 09:38
Вывод картинок из карточки товаров "галерея товара"!
<?php
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
foreach( $attachment_ids as $attachment_id )
{
echo $image_link = wp_get_attachment_url( $attachment_id );
}
?>
@flayder
flayder / product-woocomerce
Created October 2, 2015 12:02
Вывод товаров из категории woocomerce
<ul class="products">
<?php
$args = array( 'post_type' => 'product',
'posts_per_page' => 5,
'product_cat' => 'addit',
'orderby' => 'rand'
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
@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;
@flayder
flayder / popular_cakes.php
Created September 28, 2015 14:47
Вывод товара woocommerse
@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 / get_post_meta
Last active September 20, 2015 10:27
Вывод произвольных полей поста WP
<?php echo get_post_meta($post->ID, 'name_field', true); ?>
@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 / 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 / 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">