Skip to content

Instantly share code, notes, and snippets.

View asharirfan's full-sized avatar

Ashar Irfan asharirfan

View GitHub Profile
@asharirfan
asharirfan / wp_gravatar_image_url.php
Last active August 29, 2015 14:27
Gravatar Image WP Custom Function
<?php
/**
* Gravatar Image WP Custom Function
* @param string $aa_email user/author email address
* @param string $aa_size size of gravatar
* @return string gravatar image url
*/
function aa_get_gravatar($aa_email, $aa_size) {
// Convert email into md5 hash and set image size to 200 px
@asharirfan
asharirfan / wp_featured_image_src.php
Created August 21, 2015 22:33
WP Post Featured Image Url Function
@asharirfan
asharirfan / wp_similar_posts_by_category.php
Created December 24, 2015 23:01
Similar posts by category in WordPress which excludes the current post
<?php
/**
* Similar posts loop
*/
$categories = get_the_category(); //get all categories for this post
$cat_id = $categories[0]->cat_ID;
echo $cat_id;
$args = array(
'orderby' => 'date',
'order' => 'DESC',
@asharirfan
asharirfan / aa_comment_parent.php
Last active January 1, 2016 21:58
A function for WordPress. It returns true if comment is a parent and false it comment is a child.
<?php
/**
* Comment Parent Check
*
* Returns true if comment is a parent comment
* and false if it is child comment
*
*/
function aa_comment_parent($aa_comment_id) {
@asharirfan
asharirfan / script.js
Created January 14, 2016 15:17
Owl Carousel 2
/**
* function for triggering different events
* on base of slide number in
* Owl Carousel 2
* @url (http://www.owlcarousel.owlgraphic.com/)
*/
vr_slider_detailsPage.on('change.owl.carousel', function(event) {
//console.log(event.item.index);
var vr_slide_index = event.item.index;
if ( vr_slide_index == 2 ) {
@asharirfan
asharirfan / script.js
Created January 14, 2016 15:18
Owl Carousel 2 (Custom function: triggering actions on base of slide number)
/**
* function for triggering different events
* on base of slide number in
* Owl Carousel 2
* @url (http://www.owlcarousel.owlgraphic.com/)
*/
vr_slider_detailsPage.on('change.owl.carousel', function(event) {
//console.log(event.item.index);
var vr_slide_index = event.item.index;
if ( vr_slide_index == 2 ) {
@asharirfan
asharirfan / wordpress-default.css
Created February 16, 2016 20:39 — forked from madalinignisca/wordpress-default.css
Default WordPress classes for using with CSS
/**
* Default Body Class Styles
*/
.rtl {}
.home {}
.blog {}
.archive {}
.date {}
.search {}
@asharirfan
asharirfan / add_custom_field_checkout_edd.php
Created April 18, 2016 20:16
This gist is used to create custom fields in the checkout form of EDD (Easy Digital Downloads).
<?php
/**
* This gist is used to create custom fields in the
* checkout form of EDD (Easy Digital Downloads).
*/
/**
* Adding HTML for User Contact Form.
*/
function add_address_html() {
@asharirfan
asharirfan / wp-config.php
Last active August 29, 2018 10:38 — forked from ahmadawais/wp-config.php
WP Debug Logging
// Enable WP_DEBUG mode.
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file.
// Create this file yourself.
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings.
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
@asharirfan
asharirfan / LICENSE-MIT
Created July 31, 2016 13:50 — forked from electricg/LICENSE-MIT
Stopwatch in javascript
Copyright (c) 2010-2015 Giulia Alfonsi <electric.g@gmail.com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions: