Skip to content

Instantly share code, notes, and snippets.

View zeshanshani's full-sized avatar
🎯
Focusing

Zeshan Ahmed zeshanshani

🎯
Focusing
View GitHub Profile
@zeshanshani
zeshanshani / enfold-column-spacing-change.css
Created June 6, 2017 06:03
Overwrites default column spacing of Enfold Theme to 30px top/bottom/left/rigth.
/* Columns
*
* Overwrites the default
* enfold column gutter
* spacing to add a gap of
* 30px
*
* Author: Zeshan Ahmed
* Author URL: http://www.zeshanahmed.com/
*
@zeshanshani
zeshanshani / get_terms_hierarchically.php
Created April 26, 2017 09:46
Get terms/categories HTML hierarchically. Update the HTML structure as you desire in function rarus_cat_list_item();
<?php
/**
* change 'product_cat' to your desired taxonomy.
*/
$categories = get_terms( array(
'taxonomy' => 'product_cat',
'hierarchical' => false,
) );
@zeshanshani
zeshanshani / redirect_cf7_after_submission.php
Created February 17, 2017 21:38
Redirect CF7 After Submission using PHP action hook.
/**
* Redirect CF7 After Submission
*
* Accepts 'custom_on_sent_ok' parameter in CF7 form additional settings. e.g.,
* custom_on_sent_ok: http://example.com/thank-you
*/
add_action( 'wpcf7_mail_sent', 'custom_redirect_cf7_form' );
function custom_redirect_cf7_form( $wpcf7 ) {
$on_sent_ok = $wpcf7->additional_setting('custom_on_sent_ok', false);
@zeshanshani
zeshanshani / datePickerDateRange.js
Last active February 15, 2017 08:20
datePicker Date Range with maxDate 1 month
/**
* datePicker Date Range
* From: today
* To: 1 month
*
* Update to 1 month when the DateFrom is changed too.
*
* Original Code from: https://jqueryui.com/datepicker/#date-range
*/
@zeshanshani
zeshanshani / events_start_end_date_WP_Query.php
Last active December 1, 2021 10:48
WP_Query 'meta_query' for "Date Start" and "Date End" custom fields. Conditions are (relation = 'OR'): 1. If "Date End" does not exist, compare "Date Start" only. 2. If "Date End" exists, show events in between that and "Date Start".
<?php
/**
* WP_Query 'meta_query' for "Date Start" and "Date End" custom fields.
* Conditions are (relation = 'OR'):
* 1. If "Date End" does not exist, compare "Date Start" only.
* 2. If "Date End" exists, show events in between that and "Date Start".
*/
'meta_query' => array(
@zeshanshani
zeshanshani / getCursorPosition.js
Created January 17, 2017 06:20
Get the cursor position in an input field. Best to use in combination with 'keyup', 'keydown', 'focus', etc. events.
/**
* Get Cursor Position in Input Field
* @return integer Returns the cursor position.
*
* Source: Stackoverflow
* Source URI: http://stackoverflow.com/a/2897510/3107931
*
* Usage: $('input[type="text"]').getCursorPosition()
*/
$.fn.getCursorPosition = function() {
@zeshanshani
zeshanshani / AbsoluteAnchorLinksToOtherPages.js
Last active December 13, 2016 04:18
Adding Full Absolute URLs to the Anchor Links in the Navbar that are not on the same page. Works best with the parent menu and sub-menu links in the navbar. And for WordPress navbar especially.
/**
* Adding Full Absolute URLs to the Anchor Links in the Navbar that are not
* on the same page. Works best with the parent menu and sub-menu
* links in the navbar. And for WordPress navbar especially.
*
* Replace #parent_links_selector with the parent links selector
*/
jQuery(document).ready(function($) {
$('#parent_links_selector').each(function(i, el) {
@zeshanshani
zeshanshani / pure-css-cross.css
Created October 26, 2016 12:58
Pure CSS cross in both SCSS and CSS.
.element {
position: relative;
height: 22px;
height: 2.2rem;
width: 22px;
width: 2.2rem;
}
.element:before, .element:after {
content: '';
height: 1px;
@zeshanshani
zeshanshani / polylang_custom_language_switcher.css
Last active February 19, 2023 06:12
Custom Language Switcher for Polylang. Contains both the PHP function and SCSS styling. HTML markup is using BEM methodology. SCSS file is using my variables and mixins from here: https://gist.github.com/zeshanshani/c4d5ae43e6a9f661d012
/* Component: Languages */
.languages__item {
text-transform: uppercase;
color: #899099;
font-size: 13px;
font-size: 1.3rem;
line-height: 1.15;
}
.languages__item--current {
color: #212121;
@zeshanshani
zeshanshani / acf_options_multilingual.php
Last active December 10, 2025 12:51
Creates separate Advanced Custom Fields options pages for the specified languages.
<?php // Don't copy this line if you are inserting in a file that has it already.
/**
* ACF Options Page
*
* Instructions:
* Add more languages to the array below: $languages
*
* @author: Zeshan Ahmed <https://zeshanahmed.com/>
*/