Skip to content

Instantly share code, notes, and snippets.

@kisildev
kisildev / main.js
Created June 27, 2019 12:03
Filtration and load more btn
// Technologies filtration
var $container = $('.js-technologies-grid');
var $termsBox = $('.js-technologies-terms');
var $termsNav = $('.js-technologies-term');
var $allTermItems = $('.js-technologies-item');
var $loadMoreBtn = $('.js-load-more');
$termsBox.on('click', function(e) {
var $target = $(e.target);
if ($target.hasClass('js-technologies-term')) {
@kisildev
kisildev / page.php
Created June 27, 2019 09:22
ACF Flexible content
if($flexible_content = get_field('flexible_content')){
foreach($flexible_content as $key => $section){
$section['module_key'] = $key;
show_template($section['acf_fc_layout'], $section, 'parts/flexible-layouts');
}
}
?>
@kisildev
kisildev / index.php
Created June 25, 2019 15:25
WP user metadata. User data/
<section class="user-section">
<div class="container">
<div class="row">
<div class="col-md-4 col-lg-push-8">
<?php if($user_avatar = get_field('user_avatar', 'user_'.$user_id)): ?>
<div class="user-section__img-wrap">
<div class="user-section__img" <?php bg($user_avatar, null, 'medium'); ?>></div>
</div>
<?php endif; ?>
</div>
@kisildev
kisildev / main.js
Created May 30, 2019 12:31
Slick slider change slides on scrool
$slider.on('wheel', (function(e) {
e.preventDefault();
if (e.originalEvent.deltaY < 0) {
$(this).slick('slickNext');
} else {
$(this).slick('slickPrev');
}
}));
@kisildev
kisildev / main.js
Created May 27, 2019 12:37
Slick slider on mobile
$(window).on('load resize orientationchange', function() {
$('.center-slide').each(function(){
var $center_slide = $(this);
/* Initializes a slick center_slide only on mobile screens */
// slick on mobile
if ($(window).width() >= 1025) {
if ($center_slide.hasClass('slick-initialized')) {
$center_slide.slick('unslick');
}
}
@kisildev
kisildev / custom.css
Created May 16, 2019 15:26
Form input animation on focus
{code} // On click of input field the label became smaller and change to red
.gfield {
position: relative;
&_visibility_hidden {
opacity: 0;
visibility: hidden;
pointer-events: none;
}
&_label {
font-size: 25px;
@kisildev
kisildev / main.js
Created April 24, 2019 16:04
JS Check Browser
var is_opera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
var is_Edge = navigator.userAgent.indexOf("Edge") > -1;
var is_chrome = !!window.chrome && !is_opera && !is_Edge;
var is_explorer= typeof document !== 'undefined' && !!document.documentMode && !is_Edge;
var is_firefox = typeof window.InstallTrigger !== 'undefined';
var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
@kisildev
kisildev / index.php
Created April 23, 2019 08:51
Custom Breadcrumbs NavXT
<?php
add_action( 'bcn_after_fill', 'project_rebuild_breadcrumb' );
/**
* Rebuild the breadcrumb created by Breadcrumb NavXT.
*
* @param bcn_breadcrumb_trail $breadcrumb Instance of the currently active breadcrumb trail.
*/
function project_rebuild_breadcrumbs( $breadcrumb ) {
if ( ! is_singular( [ 'case-studies', 'articles', 'presentations', 'papers-reports', 'creative-portfolio' ] ) ) {
return;
@kisildev
kisildev / index.php
Last active April 17, 2019 10:31
Get Term name of current page. Get Parent Term name of current page.
//Curent Term
<?php $term = get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy') );
echo $term->name; ?>
//Curent + Parent term
<?php $term = get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy') );
$parent_term = get_term( $term->parent, get_query_var('taxonomy') );
echo $parent_term->name.' : '.$term->name; ?>
@kisildev
kisildev / functions.php
Created April 13, 2019 16:09
BEM Wp menu (by Ira Beskor)
/*-------------- Creating custom menu with BEM classes ----------------*/
// Change main menu parameters
add_filter( 'wp_nav_menu_args', 'filter_wp_menu_args' );
function filter_wp_menu_args( $args ) {
if ( $args['theme_location'] === 'header-menu' || 'blog-menu' ) {
$args['container'] = false;
$args['items_wrap'] = '<ul class="%2$s">%3$s</ul>';
$args['menu_class'] = 'menu__list';
}