Skip to content

Instantly share code, notes, and snippets.

View kirandash's full-sized avatar

Kiran Dash kirandash

View GitHub Profile
@kirandash
kirandash / main.js
Last active April 29, 2017 09:55
Slick image and video fade effect
(function($){
/********************************
* Banner Home *
********************************/
$('#banner-home').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
autoplay: true,
@kirandash
kirandash / style.css
Created April 28, 2017 05:38
Flex Bootstrap columns
/*--------------------------------------------------------------
# Modernizr
--------------------------------------------------------------*/
/* Flexbox */
.no-flexbox .nc_socialPanel {
display: block;
text-align: center;
}
.no-flexbox div.nc_socialPanel .nc_tweetContainer {
float: none;
@kirandash
kirandash / content.php
Created April 27, 2017 08:23
Clear columns for uneven height
<?php
if($count %2 == 0): echo "<div class='clearfix visible-xs'></div>"; endif;
if($count %4 == 0): echo "<div class='clearfix hidden-xs'></div>"; endif;
$count++;
endwhile; ?>
@kirandash
kirandash / functions.php
Last active May 2, 2017 11:14
Accordion Shortcode
<?php
/**
* Accordion Shortcode
*/
// Extended subscription function with subscription type variable
function accordion_shortcode($atts) {
$atts = shortcode_atts(
array(
'id' => ''
@kirandash
kirandash / main.js
Created April 25, 2017 11:28
Slick slider with animate.css
$('#banner-home .slick-home-banner').on('init', function(e, slick) {
var $firstAnimatingElements = $('div.banner-item:first-child').find('[data-animation]');
doAnimations($firstAnimatingElements);
});
$('#banner-home .slick-home-banner').on('beforeChange', function(e, slick, currentSlide, nextSlide) {
var $animatingElements = $('div.banner-item[data-slick-index="' + nextSlide + '"]').find('[data-animation]');
doAnimations($animatingElements);
});
$('#banner-home .slick-home-banner').slick({
autoplay: true,
@kirandash
kirandash / main.js
Last active April 17, 2023 09:44
Owl Carousel Destroy on desktop and Initialize on mobile
function postsCarousel() {
var checkWidth = $(window).width();
var owlPost = $("#latest-posts .posts-wrapper");
if (checkWidth > 767) {
if (typeof owlPost.data('owl.carousel') != 'undefined') {
owlPost.data('owl.carousel').destroy();
}
owlPost.removeClass('owl-carousel');
} else if (checkWidth < 768) {
owlPost.addClass('owl-carousel');
@kirandash
kirandash / header.php
Created April 22, 2017 07:30
Hamburger icon
<button class="hamburger-menu hamburger-menu--htx visible-sm">
<span><?php esc_html_e( 'Toggle menu', 'tzmotorsport' ); ?></span>
</button>
@kirandash
kirandash / index.php
Created April 19, 2017 11:22
Using datepicker field in a WP_Query Date Query
<?php
$meta_query = array(
array(
'key' => 'event_date',
'value' => date('Ymd'),
'type' => 'DATE',
'compare' => '>='
)
);
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
@kirandash
kirandash / archive.php
Created April 19, 2017 07:42
WP_Query pagination
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$resultsArgs = array(
'post_type' => 'results',
'posts_per_page' => 6,
'paged' => $paged
);
$resultsQuery = new WP_Query($resultsArgs);
if ( $resultsQuery->have_posts() ) :
?>
@kirandash
kirandash / functions.php
Created April 19, 2017 06:52
Remove “Category:”, “Tag:”, “Author:” from the_archive_title
<?php
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
}
return $title;