Skip to content

Instantly share code, notes, and snippets.

View tareq1988's full-sized avatar
🎯
Focusing

Tareq Hasan tareq1988

🎯
Focusing
View GitHub Profile
@tareq1988
tareq1988 / autoloader.php
Created January 31, 2014 18:47
Autoloader
<?php
/**
* Autoload class files on demand
*
* `Dokan_Installer` becomes => installer.php
* `Dokan_Template_Report` becomes => template-report.php
*
* @param string $class requested class name
*/
@tareq1988
tareq1988 / relative-image-url.php
Created May 23, 2014 15:55
Relative image url
<?php
function wedevs_replace_image_url( $file ) {
if ( is_array( $file ) && isset( $file['src'] ) ) {
$file['src'] = str_replace( home_url(), '', $file['src'] );
}
return $file;
}
@tareq1988
tareq1988 / deploy.sh
Created June 27, 2014 15:35
WordPress plugin deploy to wp.org repository
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH

Keybase proof

I hereby claim:

  • I am tareq1988 on github.
  • I am tareq (https://keybase.io/tareq) on keybase.
  • I have a public key whose fingerprint is 33CB 3E61 32F7 B56D 5D27 8825 156B 73B3 393D E189

To claim this, I am signing this object:

@tareq1988
tareq1988 / bootstrap-walker.php
Created September 25, 2014 13:21
Clickable Bootstrap Dropdown
<?php
/**
* Class Name: wp_bootstrap_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Bootstrap 3 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 2.0.4
* Author: Edward McIntyre - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@tareq1988
tareq1988 / search-in-meta.php
Last active August 29, 2015 14:19
Search both in wp_usermeta table and wp_users table
<?php
/**
* Search both in wp_usermeta table and wp_users table
*
* By Default WordPress search usermeta and postmeta by using `AND`
* in SQL queries. This filter replaces the `AND` with `OR`. This facilitate
* to search both in user table columns OR user meta columns
*
* @author Tareq Hasan
@tareq1988
tareq1988 / bug-hunt-one.php
Created January 9, 2012 13:32 — forked from EnvatoWP/bug-hunt-one.php
Bug Hunt One
<?php
/*
* Plugin Name: EnvatoWP Bug Hunt One
* Plugin URI: https://gist.github.com/
* Description: Bug Hunt One - Find all the bugs in this basic plugin
* Version: 0.1
* Author: EnvatoWP
* Author URI: http://envatowp.github.com/
* License: GPL2
*/
@tareq1988
tareq1988 / wp_print_r.php
Created June 25, 2012 13:14
a debugging function for php
<?php
if ( !function_exists( 'wp_print_r' ) ) {
/**
* Debugging function
*
* @param mixed $var the variable name
* @param string $title title of the variable
* @param bool $die if to die or not
*/
function wp_print_r( $var, $title = '', $die = false ) {
@tareq1988
tareq1988 / menu.less
Created December 7, 2012 11:02
Navigation menu with LESS
@borderColor: #eee;
.main-navigation {
clear: both;
display: block;
float: left;
width: 100%;
border-top: 1px solid @borderColor;
border-left: 1px solid @borderColor;
border-right: 1px solid @borderColor;
<?php
/**
* Entry Views - for counting single post views.
*
* Borrowed from Hybrid Core framework and adapted for weDevs Framework
* @package WeDevs Framework
*/
class WeDevs_Entry_Views {
public function __construct() {