Skip to content

Instantly share code, notes, and snippets.

@nsheketa
nsheketa / tec-conditionals
Created October 13, 2023 14:22 — forked from jesseeproductions/tec-conditionals
The Events Calendar Conditionals
/*-----------------------------------------------------------------------------------*/
/* The Events Calendar - Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if ( tribe_is_month() && ! is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif ( tribe_is_month() && is_tax() ) { // Month View Category Page
@nsheketa
nsheketa / event_query.php
Created October 6, 2023 15:30 — forked from markhowellsmead/event_query.php
Complex WordPress meta query by start and end date (custom meta fields)
<?php
/**
* Complex WordPress meta query by start and end date (custom meta fields)
* Intended for use on the `pre_get_posts` hook.
* Caution; this makes the query very slow - several seconds - so should be
* implemented with some form of caching.
*
* [email protected] 22.10.2019, based on code from 201 onwards
*/
@nsheketa
nsheketa / Vimeo videos autoplay on scroll
Created February 17, 2021 12:24
Vimeo autoplaying on scroll
// Vimeo video
// Nees player.min.js installed
// For autoplaying on scroll needs Scrollmagic installed
let iframe = $('.iframe-wrap iframe');
if (iframe) {
iframe.each(function (i, el) {
const options = {
id: i,
width: 1200,
@nsheketa
nsheketa / svg-drawing
Created January 24, 2021 17:19
SVG Path Drawing
<svg viewBox="0 0 376 546" fill="none" xmlns="http://www.w3.org/2000/svg">
<path class="path"/>
</svg>
///js
const $path = $('.path');
const $length= $path.get(0).getTotalLength();
console.log(length); //i.e. 200
///scss
@nsheketa
nsheketa / upload-size-increase.txt
Created October 1, 2020 17:32
Increasing max upload size php
In .htaccess file:
php_value upload_max_filesize 40M
php_value post_max_size 42M
@nsheketa
nsheketa / Ajax post loading on scroll or click
Last active April 13, 2020 15:53
Loading posts with ajax on scroll, and on click (for wordpress)
function checkBtn($btn) {
const page = $btn.data('page');
const perPage = $btn.data('per-page');
const total = $btn.data('total');
if (page * perPage < total) {
$btn.show();
} else {
$btn.hide();
}
@nsheketa
nsheketa / Select styling
Last active October 9, 2019 20:33
Styling select without external libraries
<div class="form__select-wrap">
<p class="form__select-placeholder">Select City</p>
<span class="icon"></span>
<select name="" class="form__select">
<option value="0">Select City</option>
<option value="1">Option 01</option>
<option value="2">Option 02</option>
<option value="2">Option 03</option>
<option value="2">Option 04</option>
</select>
@nsheketa
nsheketa / Slick slider tips
Last active March 17, 2020 11:08
Slick slider slick/unslick on resize
//UNSLICK slider on desktop
//will have to forcefully change sliider items opacity on resize
var homeslider, homeSliderSettings;
homeSlider = $('.home-media__slider');
homeSliderSettings = {
dots: false,
arrows: true,
fade: true,
adaptiveHeight: true,
@nsheketa
nsheketa / Animation timing
Last active August 27, 2019 21:24
Interesting animation timing functions
1. transition: transform .8s cubic-bezier(.165,.84,.44,1),-webkit-transform .8s cubic-bezier(.165,.84,.44,1);
2. transition: transform .5s cubic-bezier(.165,.84,.44,1),background .5s
cubic-bezier(.165,.84,.44,1) 0s,-webkit-transform .5s cubic-bezier(.165,.84,.44,1);}
3. transform .5s cubic-bezier(.165,.84,.44,1) 0s,opacity .5s cubic-bezier(.165,.84,.44,1),
-webkit-transform .5s cubic-bezier(.165,.84,.44,1) 0s
4. transition: opacity .6s cubic-bezier(.455,.03,.515,.955) .2s,
transform .8s cubic-bezier(.165,.84,.44,1) .2s,-webkit-transform .8s cubic-bezier(.165,.84,.44,1) .2s;}
5. scroll reveal:
transition: all 0.7s ease-in-out 0s, opacity 1.5s cubic-bezier(0.5, 0, 0, 1) 0s, transform 1.5s cubic-bezier(0.5, 0, 0, 1) 0s;
function closeModal() {
$('.modal-wrap.is-active').removeClass('is-active');
$('#overlay').fadeOut();
$('body', 'html').removeClass('no-scroll'); //if scroll was removed
}
$('.modal__close-btn').on('click', function (e) {
e.stopPropagation();
closeModal();
});