Skip to content

Instantly share code, notes, and snippets.

@zackkatz
zackkatz / EDD Admin-Only Test Payments
Last active Jul 24, 2018
Allow admins to use test payments in Easy Digital Downloads for a live store.
View EDD Admin-Only Test Payments
<?php
/*
Plugin Name: EDD Test Payments
Plugin URI: https://gist.github.com/zackkatz/7418620
Description: Allow admins to use Test Payment even when it's not enabled.
Author: Katz Web Services, Inc.
Version: 1.0
Author URI: http://katz.co
*/
@zackkatz
zackkatz / bc-texture-swatch
Created Jan 30, 2014
Force Bigcommerce to use larger images for texture swatches
View bc-texture-swatch
/**
* Convert tiny thumbnails to larger previews for product texture swatches
* @group Product
*
*/
jQuery('.textureContainer .thumbnail').attr('style', function() {
return jQuery(this).attr('style').replace('.thumbnail.png', '.preview.png');
});
@zackkatz
zackkatz / add-plugin-link-to-admin-bar.php
Last active Sep 16, 2017
Add link to WordPress Plugins page in top-level Admin Bar and Site Name submenu.
View add-plugin-link-to-admin-bar.php
@zackkatz
zackkatz / require-title.js
Created May 22, 2014
Require a title in the WordPress Edit Post screen
View require-title.js
$('body').on( 'submit.edit-post', '#post', function () {
// If the title isn't set
if( $("#title").val().length === 0 ) {
// Show the alert
alert('A title is required.');
// Hide the spinner
$('#major-publishing-actions .spinner').hide();
@zackkatz
zackkatz / debug-bar-gravity-forms-noconflict.php
Created Jul 12, 2014
The Debug Bar plugin breaks on Gravity Forms admin pages when No Conflict Mode is turned on. This plugin fixes that issue.
View debug-bar-gravity-forms-noconflict.php
<?php
/*
Plugin Name: Debug Bar for Gravity Forms No-Conflict Mode
Plugin URI: http://katz.co
Description: Enable debug bar when Gravity Forms has No Conflict Mode on.
Version: 1.0
Author: Katz Web Services, Inc.
Author URI: http://katz.co
*/
add_filter( 'gform_noconflict_scripts', 'debug_bar_add_gf_noconflict');
@zackkatz
zackkatz / gf-validate-edd-license-key.php
Last active May 3, 2021
Validate Easy Digital Downloads License Key Field in a Gravity Forms Submission
View gf-validate-edd-license-key.php
/**
* Validate a Gravity Forms license submission against EDD remote validation
*
* In Gravity Forms, for the text field you want to use as the license key entry,
* go to Advanced tab, check the "Allow field to be populated dynamically" checkbox,
* then enter the value as `edd-{download_id}`, where {download_id} is the, you guessed
* it, EDD Download ID.
*
* @param array $is_valid_and_form_array Gravity Forms passes an array with two keys: `is_valid` (boolean) and `form` (Gravity Forms form array)
* @return array Same format as incoming.
@zackkatz
zackkatz / edd-w3tc-fix-discount.php
Last active Aug 29, 2015
Prevent Easy Digital Downloads discounts from being cached by W3TC
View edd-w3tc-fix-discount.php
<?php
/**
* Plugin Name: EDD W3TC Fix Discount Codes
* Plugin URI: http://gravityview.co
* Description: Fix discount code caching issues for Easy Digital Downloads when using W3 Total Cache
* Version: 1.1
*/
if( function_exists( 'wp_suspend_cache_addition' ) ) {
@zackkatz
zackkatz / get-readme-content
Created Oct 15, 2014
Get readme response from the readme.txt configuration in EDD Software Licensing
View get-readme-content
/**
* Get readme response from the readme.txt configuration in EDD Software Licensing
*
* @param int $id Download ID
* @return array|boolean Readme array if exists; NULL if not exists
*/
function get_edd_sl_readme( $id = NULL ) {
if( !empty( $id ) && function_exists('_edd_sl_get_readme_data') ) {
@zackkatz
zackkatz / plugin-activation-functions.php
Last active Mar 21, 2019
Functions to get plugin activation and deactivation links
View plugin-activation-functions.php
<?php
/**
* Get the Activation URL for a plugin
* @param string $plugin_path Directory and file name of plugin, like: `hello-dolly/hello.php`
* @return string URL to activate the plugin
*/
function get_plugin_activation_link( $plugin_path = 'hello-dolly/hello.php' ) {
return wp_nonce_url(admin_url('plugins.php?action=activate&amp;plugin='.$plugin_path), 'activate-plugin_'.$plugin_path);
}
@zackkatz
zackkatz / gravityview-change-entry-creator-show-all-users.php
Last active Aug 29, 2015
Show all users in the Change Entry Creator dropdown (instead of just 300)
View gravityview-change-entry-creator-show-all-users.php
<?php
/*
Plugin Name: GravityView - Show All Users in Change Entry Creator
Plugin URI: http://gravityview.co
Description: Show all users in the Change Entry Creator dropdown (instead of just 300)
Version: 1.1
Author: Katz Web Services, Inc.
Author URI: http://www.katzwebservices.com
Text Domain: gravityview
License: GPLv2 or later