Skip to content

Instantly share code, notes, and snippets.

View asharirfan's full-sized avatar

Ashar Irfan asharirfan

View GitHub Profile
@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 / 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 / wp_featured_image_src.php
Created August 21, 2015 22:33
WP Post Featured Image Url Function
@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