Skip to content

Instantly share code, notes, and snippets.

function find_lawyer( $country = '', $state = '', $city = '' ) {
$meta_query = array(
array(
'key' => 'user_locations',
'compare' => '!=',
'value' => ''
),
array(
'key' => 'is_published',
@waqasy
waqasy / jt-related-posts.php
Created April 24, 2017 05:24 — forked from jtallant/jt-related-posts.php
Related Posts Function for WordPress
@waqasy
waqasy / in_array_r.php
Created December 28, 2016 10:47 — forked from iftee/in_array_r.php
Since in_array() doesn't work for multidimensional arrays, this recursive in_array_r() does the trick
<?php
/* Check if an item $search_item is in the multidimensional array $items */
function in_array_r( $search_item, $items, $strict = false ) {
foreach ( $items as $item ) {
if ( ( $strict ? $item === $search_item : $item == $search_item ) || ( is_array( $item ) && in_array_r( $search_item, $item, $strict ) ) ) {
return true;
}
}
@waqasy
waqasy / nginx.conf
Created December 20, 2016 09:18 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
<?php
/**
* Plugin Name: NGINX FastCGI cache purge
* Version: 0.1
* Description: Flush NGINX FastCGI cache purge
* Author: The Shipyard Crew
* Author URI: https://theshipyard.se/
* Plugin URI: https://theshipyard.se/
* Text Domain: nginx-fastcgi-cache-purge
@waqasy
waqasy / pug-bomb.php
Created August 6, 2016 09:03 — forked from retgef/pug-bomb.php
Pug Bomb API Endpoint WordPress Plugin
<?php
/*
Plugin Name: Pug Bomb API Endpoint
Description: Adds an API endpoint at /api/pugs/$n_pugs
Version: 0.1
Author: Brian Fegter
Author URL: http://coderrr.com
*/
class Pugs_API_Endpoint{
@waqasy
waqasy / simple-json-api.php
Created August 6, 2016 08:14 — forked from daggerhart/simple-json-api.php
Simple Read-Only JSON API example for WordPress
<?php
/**
* Class Simple_Json_Api
*/
class Simple_Json_Api {
/**
* The top level argument for the endpoint.
* ex http://example.com/myjson/post/1
/* This function check a array value exists in an indexed array or numeric array */
function indexed_in_array($value, $array){
if (in_array($value, $array))
{
return true;
}
else
{
return false;
}
@waqasy
waqasy / wp-db.tutorial.php
Created July 28, 2016 12:15 — forked from benbalter/wp-db.tutorial.php
WordPress DB Tutorial
<?php
//absolute path to wp-load.php, or relative to this script
//e.g., ../wp-core/wp-load.php
include( 'trunk/wp-load.php' );
//grab the WPDB database object, using WP's database
//more info: http://codex.wordpress.org/Class_Reference/wpdb
global $wpdb;
@waqasy
waqasy / social.js
Created October 24, 2015 18:54
Facebook Login
/**
* @author www.juliocanares.com/cv
* @email [email protected]
*/
var getJSUserData, loginUser, postToFacebook;
getJSUserData = function (callback) {
FB.getLoginStatus((function (response) {
if (response.status === "connected") {