Skip to content

Instantly share code, notes, and snippets.

Avatar

Sahil SahilMepani

View GitHub Profile
@SahilMepani
SahilMepani / cloudSettings
Last active Sep 3, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2020-09-03T03:26:35.403Z","extensionVersion":"v3.4.3"}
View instagram-feeds.php
<!-- Helper Funcion -->
function get_instagram_feed( $max_images = 10 ) { // max 33 allowed https://rudrastyh.com/instagram/more-than-33.html
//Variables cannot be empty. Replace with app details
$user_id = '2796811886';
$access_token = '2796811886.1677ed0.f30b6326b0474fd79447aac899d2a167';
$max_images = $max_images; //image count
$instaResult = get_transient( 'instagram_feed_trans' );
if ( false === $instaResult || $instaResult == "") {
@SahilMepani
SahilMepani / list-grid-view-posts.js
Last active Jan 2, 2019
Change the view of posts in grid or list. Used on LDVA
View list-grid-view-posts.js
var listPosts = $('.list-post-cards');
$('.filters__item--view button').click(function(e) {
e.preventDefault();
$('.filters__item--view button').removeClass('js-active');
$(this).addClass('js-active');
var selectedView = $(this).data('view');
if ( $(listPosts).hasClass('list-view') && selectedView == 'list-view' ) {
return;
} else if ( $(listPosts).hasClass('grid-view') && selectedView == 'grid-view' ) {
return;
View slick-carousel.js
View single-slide-progress-bar.js
function cswvnSlider() {
$( '.cswvn-slider' ).each( function() {
var $cswvnSliderInstance = $( this ).slick({
mobileFirst: true,
autoplay: true,
autoplaySpeed: 5000,
touchThreshold: 30,
infinite: false,
speed: 500,
arrows: false,
@SahilMepani
SahilMepani / slick-custom.js
Last active Aug 16, 2018
It will unslick for screen size higher than 767px.
View slick-custom.js
$( '.list-map-clients' ).slick( {
mobileFirst: true,
centerMode: true,
centerPadding: '0px',
touchThreshold: 20,
speed: 500,
slidesToShow: 1,
arrows: true,
responsive: [
{
@SahilMepani
SahilMepani / slick-custom.js
Last active Feb 24, 2018
JS: Slick: Resettings slick on window resize
View slick-custom.js
$slick_slider = $('.slider');
settings = {
// some settings
}
$slick_slider.slick(settings);
// reslick only if it's not slick()
$(window).on('resize', function() {
if ($(window).width() < 768) {
if ($slick_slider.hasClass('slick-initialized')) {
@SahilMepani
SahilMepani / any.php
Last active Feb 24, 2018
WPML: Get posts from each term/category in accordion style for different languages.
View any.php
<?php
/*=============================================================================
= WPML Get posts from each terms in accordion style for =
=============================================================================*/
$args = array(
'taxonomy' => 'TAXONOMY', // defaults to 'category'
'parent' => 0, // top level only
);
$terms = get_terms( $args );
?>
@SahilMepani
SahilMepani / functions.php
Last active Feb 24, 2018
WPML: Language switcher with only flags
View functions.php
<?php
/*=========================================================
= WPML language switcher only flags =
=========================================================*/
function language_selector_flags() {
$languages = icl_get_languages( 'skip_missing=0&orderby=code' );
if ( ! empty($languages) ) {
foreach ( $languages as $l ) {
if ( ! $l['active'] ) echo '<a href="'.$l['url'].'">';
echo '<img src="'.$l['country_flag_url'].'" height="12" alt="'.$l['language_code'].'" width="18" />';
@SahilMepani
SahilMepani / any.php
Last active Feb 24, 2018
PHP: Odd/Even
View any.php
<?php
if ( $i&1 ) {
$animation = 'fadeInRight';
} else {
$animation = 'fadeInLeft';
}
?>