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 / gulpfile.js
Created October 28, 2015 01:18 — forked from ninjasort/gulpfile.js
Gulp Workflow - Sass, Uglify, Express, Copy, Bourbon, Neat, BrowserSync
var gulp = require('gulp'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify'),
header = require('gulp-header'),
filter = require('gulp-filter'),
concat = require('gulp-concat'),
browserSync = require('browser-sync'),
sass = require('gulp-sass'),
bodyParser = require('body-parser'),
express = require('express'),
@zeshanshani
zeshanshani / windowFullScreen.js
Last active April 24, 2019 20:20
Stretch banner to fill fullscreen but keep the height minimum so on smaller screens, content inside won't overlap.
// jQuery Window FullScreen Plugin
//
// Author: Zeshan Ahmed
// Author URI: http://www.zeshanahmed.com/
//
// = Replace .element_to_target with the your element selector
jQuery(document).ready(function($) {
var $win = $(window),
$element = $('.element_to_target'),
@zeshanshani
zeshanshani / acf-wrapper-functions.php
Created November 4, 2015 22:19 — forked from raideus/acf-wrapper-functions.php
Wrapper functions for Advanced Custom Fields
<?php
/**
* Return a custom field stored by the Advanced Custom Fields plugin
*
* @global $post
* @param str $key The key to look for
* @param mixed $id The post ID (int|str, defaults to $post->ID)
* @param mixed $default Value to return if get_field() returns nothing
* @return mixed
* @uses get_field()
@zeshanshani
zeshanshani / wp-snippets.php
Last active November 27, 2015 19:13
Helpful WordPress snippets for daily use.
<?php
/**
* Get the author profile URL
**/
$author_id = get_the_author_meta( 'ID' );
$author_url = get_author_posts_url( $author_id );
@zeshanshani
zeshanshani / ExcerptLengthByCharacter.php
Created December 30, 2015 05:46
Limit WordPress excerpt length by character and keep last word complete, i.e., instead of 'compat...' show full last word, i.e. 'compatibility...'.
// Excerpt - Limit Length by Characters and Keep Last Word Complete.
// Solution from:
// https://wordpress.org/support/topic/limit-excerpt-length-by-characters#post-2248039
// ================================================================================
function excerpt_character_length( $excerpt ){
$permalink = get_permalink($post->ID);
$excerpt = get_the_content();
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
$excerpt = strip_shortcodes($excerpt);
@zeshanshani
zeshanshani / WC-Exclude-Products-From-Shop.php
Created February 9, 2016 12:34
WooCommerce - Exclude Products from Shop Page using IDs.
<?php
// WooCommerce - Exclude Products from Shop Page using IDs.
// =============================================================================
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
function custom_pre_get_posts_query( $q ) {
if ( ! $q->is_main_query() ) return;
@zeshanshani
zeshanshani / customizer-controls-40.php
Last active March 5, 2016 08:00 — forked from devinsays/customizer-controls-40
WordPress 4.0 Customizer Controls
<?php
function prefix_customizer_register( $wp_customize ) {
$wp_customize->add_panel( 'panel_id', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Example Panel', 'textdomain' ),
'description' => __( 'Description of what this panel does.', 'textdomain' ),
@zeshanshani
zeshanshani / extendedAnimations.css
Last active June 10, 2016 13:39
Extended Animations - Utilizes animate.css. Provides data attributes to add animations in any element on the page. Triggers animations on scroll. Updated: trigger all animations in one section at once.
/**
* Extended Sections Animations
* By: Zeshan Ahmed
* URI: http://www.zeshanahmed.com/
*
* Extended animations trigger on scroll. Uses animate.css.
*/
.not-animated {
opacity: 0;
@zeshanshani
zeshanshani / gist:05dc77bf977a74dec9104fc72501b03d
Created May 17, 2016 07:29 — forked from betweenbrain/gist:5405671
Use cURL and SimpleXML to retrieve and parse Wordpress RSS feed
<?php
$curl = curl_init();
curl_setopt_array($curl, Array(
CURLOPT_URL => 'http://blogs.guggenheim.org/map/feed/',
CURLOPT_USERAGENT => 'spider',
CURLOPT_TIMEOUT => 120,
CURLOPT_CONNECTTIMEOUT => 30,
CURLOPT_RETURNTRANSFER => TRUE,