Skip to content

Instantly share code, notes, and snippets.

View zeshanshani's full-sized avatar
🎯
Focusing

Zeshan Ahmed zeshanshani

🎯
Focusing
View GitHub Profile
{
// Goes inside Preference.sublime-settings -- User
//
// First "theme" line defines which Boxy theme you've selected
// Rest of the lines are configuration of Boxy theme itself.
//
// Boxy theme full settings: https://github.com/ihodev/sublime-boxy/wiki/Settings#accent
"theme": "Boxy Tomorrow.sublime-theme",
"theme_accent_purple": true,
"theme_bar": true,
@zeshanshani
zeshanshani / WebFont_Loader_Google_fonts_config.html
Created August 17, 2017 10:36
Config for loading Google fonts Asynchronously using Web Font Loader: https://github.com/typekit/webfontloader
<script>
WebFontConfig = {
google: {
families: ['Montserrat:400,700', 'Open Sans:300,400,600,700', 'Roboto']
}
};
(function(d) {
var wf = d.createElement('script'), s = d.scripts[0];
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
wf.async = true;
@zeshanshani
zeshanshani / fix-navbar-on-scroll.css
Last active July 30, 2017 19:01
Fixed navbar on scroll by checking the current navbar position and applying the class only when the navbar.offset().top is larger than $window.scrollTop
.header-area.header-area-fixed
{
position: fixed;
width: 100%;
left: 0;
top: 0;
}
.admin-bar .header-area.header-area-fixed
{
@zeshanshani
zeshanshani / MyValetDriver.php
Created July 18, 2017 14:12
Valet site change document root using Valet Custom Driver
<?php
// Change 'site_folder_name' with your valet site's name, e.g., gutenberg
// Change '/root-folder' with the root folder you want to start
// when you type e.g., gutenberg.dev
class MyValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
@zeshanshani
zeshanshani / getURLParameter.js
Created July 3, 2017 11:45
Get URL Parameter using JavaScript
/**
* Get URL Parameter
*
* By: Zeshan Ahmed
* URI: http://www.zeshanahmed.com/
* Source: stackoverflow (question unknown)
*
* This function is used to get the parameter from current URL or
* the URL passed via second argument in the function.
*
@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(