Skip to content

Instantly share code, notes, and snippets.

View BFTrick's full-sized avatar

Patrick Rauland BFTrick

View GitHub Profile
<?php
/**
* Plugin Name: WCS 1.4 Upgrade Fix
* Plugin URI:
* Description: Custom plugin to fix a database that fell out of sync with Subscriptions 1.4's database structure.
* Author: Brent Shepherd
* Author URI:
* Version: 1.0
*/
@DanielSantoro
DanielSantoro / gist:b386934f8502f0077dea
Created July 7, 2014 15:17
Show Options Page in "Settings" Section
// Adds "All Settings" link in the Settings Tab for Admins
function all_settings_link() {
add_options_page(__('All Settings'), __('All Settings'), 'administrator', 'options.php');
}
add_action('admin_menu', 'all_settings_link');
@kamranayub
kamranayub / gist:853906
Created March 4, 2011 00:26
Generates a URL-friendly "slug" from an unsanitized string
/// <summary>
/// Will transform "some $ugly ###url wit[]h spaces" into "some-ugly-url-with-spaces"
/// </summary>
public static string Slugify(this string phrase, int maxLength = 50)
{
string str = phrase.ToLower();
// invalid chars, make into spaces
str = Regex.Replace(str, @"[^a-z0-9\s-]", "");
// convert multiple spaces/hyphens into one space
@xentek
xentek / wp-unit-tests.md
Created August 26, 2012 19:06
WordPress Unit Tests Quick Start

WordPress Unit Tests Quick Start Guide

This quick start guide is geared towards installing PHPUnit on OSX in order to run the WordPress unit tests. It uses homebrew to install PHP using homebrew-php. You can likely skip this step if you've already got php and pear installed properly.

If you use MAMP, then try these instructions to use MAMP's php and pear to install PHPUnit.

install homebrew

ruby &lt;(curl -fsSkL raw.github.com/mxcl/homebrew/go)
@BFTrick
BFTrick / morning-coffee.sh
Last active December 19, 2015 01:29
A shell script to download the latest WooThemes updates from GitHub
##
# pull down all woothemes repos from github
# https://gist.github.com/BFTrick/5876275
##
echo "Hi there! Grab a cup of coffee. I'll pull down the latest updates from Github"
# declare where our repository folder is located
repositoryLocation="repos"
@blobaugh
blobaugh / gist:7223022
Created October 29, 2013 21:32
Add additional support for Infinite Scroll in Jetpack
function tweakjp_custom_is_support() {
$supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_archive() || is_search() );
return $supported;
}
add_filter( 'infinite_scroll_archive_supported', 'tweakjp_custom_is_support' );
@thenbrent
thenbrent / woocommerce-disable-paypal-for-subscriptions.md
Last active October 31, 2016 20:17
Using WooCommerce and want to disable PayPal for subscription purchases, but still offer it as an option for buying one-off products? Activate this plugin.

This gist has been migrated to a repo here.

@ChromeOrange
ChromeOrange / gist:8287925
Last active February 25, 2020 04:22
Delete all tax rates from WooCommerce
/**
* Delete ALL WooCommerce tax rates
*
* Add to your theme functions.php then go to woocommerce -> system status -> tools and there will be a delete all tax rates button http://cld.wthms.co/tXvp
*/
add_filter( 'woocommerce_debug_tools', 'custom_woocommerce_debug_tools' );
function custom_woocommerce_debug_tools( $tools ) {
$tools['woocommerce_delete_tax_rates'] = array(
@andrewlimaza
andrewlimaza / depends-example.php
Last active June 8, 2021 20:40
Register Helper Depends Example
<?php
//we have to put everything in a function called on init, so we are sure Register Helper is loaded
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
return false;
}
<?php
/* Sample Register Helper fields
Register Helper Add On (https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/)
Add this to your customization plugin for PMPro Customizations: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
or