Skip to content

Instantly share code, notes, and snippets.

View ramiabraham's full-sized avatar

Rami Abraham ramiabraham

View GitHub Profile
<?php
/**
* Disable all non-whitelisted jetpack modules.
*
* This will allow all of the currently available Jetpack modules to work
* normally. If there's a module you'd like to disable, simply comment it out
* or remove it from the whitelist and it will no longer load.
*
* @author FAT Media, LLC
* @link http://wpbacon.com/tutorials/disable-jetpack-modules/
<?php
/**
* Plugin Name: Static Templates
*
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
*
* Examples:
*
@ramiabraham
ramiabraham / debug.php
Last active August 29, 2015 13:57
WP_DEBUG via query parameter, WP_DEBUG dev stack
// Allows you to add ?debug=true query parameter
// For live sites in which a dev environment is not possible.
if ( isset($_GET['debug']) && $_GET['debug'] == 'true') {
define('WP_DEBUG', true);
}
// A nice stack recommended by @jjeaton,
// for dev environments:
@ramiabraham
ramiabraham / thesis_5_4.php
Created July 8, 2014 17:01
Adjusts Thesis themes to be compliant with PHP >= 5.4 in options_post.php
if (($meta_field['type']['type'] == 'checkbox') && is_array($meta_field['type']['options'])) {
to:
if ((is_array($meta_field['type'])) && ($meta_field['type']['type'] == 'checkbox') && is_array($meta_field['type']['options'])) {
@ramiabraham
ramiabraham / ie-can-suck-it.css
Created July 23, 2014 15:25
IE font smoothing :(
/* add other elements as needed */
h1, h2, h3, h4, h5, h6, p, li, td {
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OTJBQkFGRUZFOTIyMTFFMEJDRDNEQzkxOTVGOTNBODAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OTJBQkFG
@ramiabraham
ramiabraham / gist:72e62a808a100d32a782
Created September 9, 2014 02:50
AffiliateWP Front-EndDashboard Stats For Current User
<?php
/*
Plugin Name: AffiliateWP Dashboard Stats For Current User
Plugin Script: affiliatewp dashboard stats.php
Plugin URI: http://affiliatewp.com
Description: Adds AffiliateWP Dashboard Stats For Current User
Version: 0.1
License: GPL
Author: AffiliateWP
@ramiabraham
ramiabraham / affwp-affiliate-id-shortcode.php
Last active August 29, 2015 14:06
Affiliate ID shortcode
<?php
/*
Plugin Name: AffiliateWP Affiliate ID Shortcode
Plugin URI: http://affiliatewp.com
Description: Adds a shortcode that displays the AffiliateWP affiliate id.
Version: 0.1
Author: AffiliateWP
Author URI: http://affiliatewp.com
*/
@ramiabraham
ramiabraham / sticky.js
Last active August 29, 2015 14:07
sticky div (typically a sidebar) with compat for touch devices
(function($) {
$(window).bind("load", function() {
var sidebar_one = $('#sidebar-1' );
var sidebar_two = $('#sidebar-2');
$( window ).scroll( function() {
if ( $(this).scrollTop() > 660 && $(this).width() > 1024 ) {
@ramiabraham
ramiabraham / edd.php
Last active August 29, 2015 14:07 — forked from amdrew/edd.php
<?php
/**
* Disable commission on an entire product category in Easy Digital Downloads
*/
function affwp_custom_wc_disable_commission_per_category( $referral_amount, $affiliate_id, $amount, $reference, $product_id ) {
// Array of categories to disable commission for. Separate by a comma and use either the term name, term_id, or slug
$disabled_categories = array( 'category-one', 5 );
@ramiabraham
ramiabraham / gist:0ec0df2e67ed31331cc5
Created February 26, 2015 14:03
AffiliateWP - force pending / accepted referrals
<?php
// set as pending by default
// add_filter( 'affwp_auto_complete_referral', '__return_false' );
// set as accepted by default
add_filter( 'affwp_auto_complete_referral', '__return_true' );