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 / html.json
Last active September 21, 2020 12:44
Expand PHP conditionals in HTML in VS Code.
{
// ECHO
"PHP Echo Tag": {
"prefix": "echo",
"body": [
"<?php echo ${1:\\$var}; ?>"
],
"description": "Expand \"echo\" into PHP echo block"
},
@zeshanshani
zeshanshani / acf-widget-title-link.php
Last active November 6, 2017 06:34
Add Link to Widget Title using ACF
@zeshanshani
zeshanshani / random_posts_via_AJAX.php
Created October 27, 2017 19:37
Random Posts via AJAX. Use this function to get the random posts in a AJAX callback handler.
<?php // don't include this line.
/**
* Random Posts
* @param integer $count describe how many random posts you would want to fetch.
* @return string HTML of the returned posts.
*/
function za_random_related_posts( $count = 3 ) {
global $global_exclude_post_ids;
@zeshanshani
zeshanshani / primary_category.php
Created September 19, 2017 09:46 — forked from jawinn/primary_category.php
Display Primary Category (Yoast's WordPress SEO)
<?php
// SHOW YOAST PRIMARY CATEGORY, OR FIRST CATEGORY
$category = get_the_category();
$useCatLink = true;
// If post has a category assigned.
if ($category){
$category_display = '';
$category_link = '';
if ( class_exists('WPSEO_Primary_Term') )
A File Icon
AdvancedNewFile
Alignment
All Autocomplete
AutoFileName
Autoprefixer
Boxy Theme
Boxy Theme Addon - Widget Font Size
BracketHighlighter
Color Highlighter
{
// 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.
*