Skip to content

Instantly share code, notes, and snippets.

@netconstructor
netconstructor / functions.php
Created February 5, 2011 04:30
Drag & Drop (functions.php code and referenced JS file below)
///////////////////////////////////////////////////////////////////////////////////////////
// CODE TO ADD POST PER PAGE FILTER
///////////////////////////////////////////////////////////////////////////////////////////
add_filter( 'edit_posts_per_page', 'reorder_edit_posts_per_page', 10, 2 );
function reorder_edit_posts_per_page( $per_page, $post_type ) {
// CHECK USER PERMISSIONS
if ( !current_user_can('edit_others_pages') )
return;
$post_type_object = get_post_type_object( $post_type );
@mikejolley
mikejolley / gist:1597957
Created January 12, 2012 01:40
WooCommerce - Replace '' with 'Call for price' when price is left blank
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_empty_price_html', 'custom_call_for_price');
function custom_call_for_price() {
return 'Call for price';
}
@ChromeOrange
ChromeOrange / gist:5416643
Last active December 16, 2015 09:59
Hide free shipping if shipping state for WooCommerce 2
add_filter( 'woocommerce_package_rates', 'hide_standard_shipping_in_state' , 10, 2 );
/**
* Hide free shipping if shipping state is AK, AL, AR, HI, MA, MS, PA, or UT
*
* @param array $available_methods
*/
function hide_standard_shipping_in_state( $rates, $package ) {
$excluded_states = array( 'AK','AL','AR','HI','MA','MS','PA','UT' );
@eriteric
eriteric / movegfjstofooter.php
Last active October 13, 2021 16:55
Load gravity forms JS in footer
// GF method: http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/filters/gform_init_scripts_footer/
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from https://bjornjohansen.no/load-gravity-forms-js-in-footer
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
}
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );
@Prophe1
Prophe1 / config.yml
Last active August 18, 2022 14:50
CircleCI + WPEngine + SAGE
# Continuous Integration to a WP Engine install
# PHP CircleCI 2.0 configuration file
#
# You need to generate and add SSH key to CircleCI project SSH Permissions tab
# And then copy fingerprint and replace YOUR_SSH_KEY with it. Also same Key must be added to WPEngine's project SSH tab.
# After, You need to add environtmen varriables WP_THEME_DIR - theme directory and WPE_INSTALL -
# WPEngine install name/slug. You need to have .gitignores folder with two files (__default and __production)
# __default means that it will be used in local develoment, and __production will be used when pushing to WPEngine
version: 2