View _log.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _log( $message, $pre = '' ) { | |
if ( true === WP_DEBUG && !defined( 'DOING_CRON' ) && !defined( 'DOING_AJAX' ) ) { | |
if ( $pre ) { | |
error_log( $pre ); | |
} | |
if ( is_array( $message ) || is_object( $message ) ){ | |
error_log( print_r( $message, true ) ); | |
} else { | |
error_log( $message ); | |
} |
View gist:03fff9092b67bf162e8f4e1c1041d0a9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$current_price_int = 149; | |
if ( edd_cart_has_discounts() ) { | |
$discounts = edd_get_cart_discounts(); | |
$discount_code = $discounts[0]; | |
} elseif ( isset( $_GET['discount'] ) ) { | |
$discount_code = $_GET['discount']; | |
} | |
if ( $discount_code ) { | |
$new_price = edd_get_discounted_amount( $discount_code, $current_price_int ); | |
} |
View gist:13ecc24bc172d13b9195a98bda7d2400
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In my header.php file right below the </head> tag | |
<?php if ( is_page( 'pro' ) && !edd_cart_has_discounts() ) { | |
<!-- Code provided by Google Experiments --> | |
<?php } } ?> |
View woocommerce-acf-tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First create a field group assigned to the Product custom post type | |
// Make a repeater field with sub-fields "Title" (text) and "Content" (WYSIWYG) | |
add_filter( 'woocommerce_product_tabs', 'custom_tabs' ); | |
function custom_tabs( $tabs ) { | |
global $post; | |
$priority = 100; | |
while ( has_sub_field( 'tabs', $post->ID ) ) { | |
$title = get_sub_field( 'title' ); |
View ACF Divisions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class acf_field_divisions extends acf_field | |
{ | |
// vars | |
var $settings, // will hold info such as dir / path | |
$defaults; // will hold default field options | |
/* |
View WordPress Maintenance Message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wp', 'coming_soon'); | |
function coming_soon() { | |
if (current_user_can('manage_options')) return; | |
wp_die('We are quickly performing an upgrade to our site - should be back up shortly.'); | |
} |