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( 'save_post', 'custom_featured_image_size', 10, 2 ); | |
function custom_featured_image_size( $post_id, $post ) { | |
$image_size_name = 'my-custom-image-size'; | |
$cpt = 'my-cpt'; | |
$width = 1600; | |
$height = 1600; | |
$crop = false; | |
// Only for my CPT. |
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 ); | |
} |
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 ); | |
} |
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 } } ?> |
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' ); |
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 | |
/* |
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.'); | |
} |