Skip to content

Instantly share code, notes, and snippets.

Keybase proofI hereby claim: * I am ajithrn on github. * I am ajithrn (https://keybase.io/ajithrn) on keybase. * I have a public key whose fingerprint is 5F27 72B1 14D4 A3DF B546 B887 3885 85FE A8FE A168To claim this, I am signing this object:```json{ "body": { "key": { "eldest_kid": "010156aa08d1a6a35f6d82389a82f243d748c65b5c6df93bf68f1fc2678969b6f6800a", "fingerprint": "5f2772b114d4a3dfb546b887388585fea8fea168", "host": "keybase.io", "key_id": "388585fea8fea168", "kid": "010156aa08d1a6a35f6d82389a82f243d748c65b5c6df93bf68f1fc2678969b6f6800a", "uid": "d7159c83cb4a68e2224f3e7d64296019", "username": "ajithrn" }, "service": { "name": "github", "username": "ajithrn" }, "type": "web_service_binding", "version": 1 }, "ctime": 1480881277, "expire_in": 157680000, "prev": "3e06523e876e9b04cc93054c457a9d8eaec95faef638dc72f7b491416fa25054", "seqno": 7,

@ajithrn
ajithrn / export.sql
Created December 2, 2016 20:23 — forked from jonahcoyote/export.sql
Sabai Directory Export SQL
/*
Intro:
Here are some export examples you can use to export Sabai directory data. I'm no MySQL expert and there's probably better ways to run these queries but this worked for my purposes. I hope this helps!
Note, this is going to export all columns and you'll need to manually go in and remove columns you don't need in Excel or Numbers or whatever spreadsheet program you have.
Usage:
This is meant to be run in phpMyAdmin. Look at your own table structure and modify as necessary for any custom fields, table prefix, and custom bundle. Custom fields are storedin their own tables and cross linked via entity_id which is the id of a listing.
*/
@ajithrn
ajithrn / remove-rev-slider-meta.php
Created August 27, 2016 21:42
WP: Remove Rev Slider metabox
/**
* Helper for removing the Revslider Metabox from being on every CPT edit screen
* Modified for sagetheme (roots.io), place in the lib/extras.php
* Ref: https://gist.github.com/DevinWalker/ee9d4e53883460c6bbb8
*
* @param $post_type
*/
function remove_revslider_metabox($post_type)
{
add_action('do_meta_boxes', function () use ($post_type) {
@ajithrn
ajithrn / wp-include-jquery.php
Created October 5, 2015 17:13
WordPress: Inclide Jquery
/**
* Add jQuery from google cdn
*/
function add_jquery_script() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', '', false);
@ajithrn
ajithrn / .htaccess
Last active August 29, 2015 14:27
Web: Referral Spam
## SITE REFERRER BANNING
RewriteCond %{HTTP_REFERER} floating-share-buttons.com [NC,OR]
RewriteCond %{HTTP_REFERER} floating-share-buttons.com
RewriteRule .* - [F]
@ajithrn
ajithrn / wp-query-order.php
Created August 2, 2015 18:07
WP: Order by multiple meta keys in WP Query
<?php
/**
* This will allow to sort/filter according to different meta key values
* ref: https://mathieuhays.co.uk/order-by-multiple-post-meta-in-wp-query/
*
*/
$args = array(
'post_type' => 'my_post_type',
'posts_per_page' => 10,
@ajithrn
ajithrn / wp-acfrep.php
Last active August 29, 2015 14:22
WordPress: ACF Repeater
<?php if( have_rows('repeater_field_name') ): // check if the repeater field has rows of data ?>
<?php while ( have_rows('repeater_field_name') ) : the_row(); // loop through the rows of data ?>
<?php $foo = get_sub_field('sub_field_name'); // getting a sub field value ?>
<?php endwhile; ?>
<?php else: // no rows found ?>
@ajithrn
ajithrn / auth-url-rewrite.php
Created May 31, 2015 08:19
WordPress: rewrite wp author url
<?php
/**
* author base url rewrire
*
*/
function wp_author_base() {
global $wp_rewrite;
$author_slug = 'user-profile'; // change slug name here
$wp_rewrite->author_base = $author_slug;
}
@ajithrn
ajithrn / soil-nav walker.php
Last active April 20, 2017 02:31
WordPress: Soli Nav walker Modified
<?php
/*
* Modified soil nav walker to add the missing dropdown to the parent li of the ul.sub-menu
*/
namespace Roots\Soil\Nav;
use Roots\Soil\Utils;
/**
@ajithrn
ajithrn / emails.txt
Created April 30, 2015 21:30
Regex: Search emails
[a-zA-Z0-9.!#$%&'*+-/=?\^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*