Skip to content

Instantly share code, notes, and snippets.

@kisildev
kisildev / functions.php
Created September 18, 2018 15:21
What template (wordpress)
// in footer.php or header.php
<div><strong>Current template:</strong> <?php get_current_template( true ); ?></div>
// in functions.php
/**
* Define current template file
*
* Create a global variable with the name of the current
* theme template file being used.
*
@kisildev
kisildev / jquery.fancybox.pack.js
Created September 18, 2018 11:46
Fancybox 2 helper file, popup
/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
(function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20,
width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},s
@kisildev
kisildev / common.js
Created September 17, 2018 05:34
Isotope Filter
jQuery(document).ready(function($) {
var $filterBox = $('.filter').isotope({
itemSeletor: '.filter',
layoutMode: 'fitRows'
});
$('.filter-btn').on('click', function() {
var filterValue = $(this).data('filter');
$filterBox.isotope({
filter: filterValue
@kisildev
kisildev / main.scss
Created September 12, 2018 13:18
Custom scrollbar
/// Mixin to customize scrollbars
/// Beware, this does not work in all browsers
/// @author Hugo Giraudel
/// @param {Length} $size - Horizontal scrollbar's height and vertical scrollbar's width
/// @param {Color} $foreground-color - Scrollbar's color
/// @param {Color} $background-color [mix($foreground-color, white, 50%)] - Scrollbar's color
/// @example scss - Scrollbar styling
/// @include scrollbars(.5em, slategray);
@mixin scrollbars($size, $foreground-color, $background-color: mix($foreground-color, white, 50%)) {
// For Google Chrome
@kisildev
kisildev / common.js
Last active September 12, 2018 12:43
Social media (share)
//Открыть окно поделиться в новом, маленьком окне
$('.share__link').click(function (e) {
e.preventDefault();
var wpWidth = $(window).width(), wpHeight = $(window).height();
window.open($(this).attr('href'),'Share',"top="+(wpHeight-400)/2 + ",left="+(wpWidth-600)/2+",width=600,height=400");
})
@kisildev
kisildev / functions.php
Created September 7, 2018 08:36
Woocommerce products category
function add_products_cat() {
$orderby = 'name';
$order = 'asc';
$hide_empty = false ;
$cat_args = array(
'orderby' => $orderby,
'order' => $order,
'hide_empty' => $hide_empty,
);
@kisildev
kisildev / index.php
Created September 5, 2018 13:29
WP trim words
<?php echo $trimed_content = apply_filters('the_content', wp_trim_words(get_the_content(), 62)); ?>
@kisildev
kisildev / index.php
Created September 5, 2018 08:32
WP Loop
<div class="container">
<div class="row">
<div class="col-md-12">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
@kisildev
kisildev / main.scss
Created August 17, 2018 09:30
Line-height Crop
@mixin lhCrop($line-height) {
&::before {
content: '';
display: block;
height: 0;
width: 0;
margin-top: calc((1 - #{$line-height}) * 0.5em);
}
}
@kisildev
kisildev / marckup.html
Created August 9, 2018 13:44
HTML Markup
<h2>Headings</h2>
<h1>Header one</h1>
<h2>Header two</h2>
<h3>Header three</h3>
<h4>Header four</h4>
<h5>Header five</h5>
<h6>Header six</h6>
<h2>Blockquotes</h2>
<p>Single line blockquote:</p>
<blockquote><p>Stay hungry. Stay foolish.</p></blockquote>