This file contains hidden or 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 | |
[...] | |
'template' => | |
array( | |
array('core/archives'), | |
array('core/audio'), | |
array('core/block'), | |
array('core/button'), | |
array('core/categories'), |
This file contains hidden or 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 | |
// Intended to go into functions.php of parent or child theme. | |
// Assumes directory structure of /theme-name/skins/folder-name/theme.json (see switch statement below). | |
/** | |
* Conditionally load the default theme.json file. | |
* | |
* @package coaching-pro | |
*/ |
This file contains hidden or 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 | |
/** | |
* By default, cURL sends the "Expect" header all the time which severely impacts | |
* performance. Instead, we'll send it if the body is larger than 1 mb like | |
* Guzzle does. | |
*/ | |
function add_expect_header(array $arguments) | |
{ | |
$arguments['headers']['expect'] = !empty($arguments['body']) && strlen($arguments['body']) > 1048576 ? '100-Continue' : ''; |
This file contains hidden or 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 | |
new theme_customizer(); | |
class theme_customizer { | |
public function __construct() { | |
add_action( 'customize_register', array(&$this, 'customize_linje' )); | |
} | |
/** | |
* Customizer manager demo |
This file contains hidden or 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 | |
/** | |
* Use namespace to avoid conflict | |
*/ | |
namespace PostType; | |
/** | |
* Class Event | |
* @package PostType | |
* |
This file contains hidden or 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 | |
/** | |
* Save Gravity Form field data to post meta by adding a class to any field. | |
* Meta is mapped so that it is readable by Advanced Custom Fields | |
* Format class as… | |
* post_meta-{meta_key} -- for simple fields & writing lists as array to single meta record | |
* post_meta-{meta_key}-.3 -- for multi-input fields | |
* post_meta-{repeater_key}-1.{meta_key} -- for list fields mapped to meta readable by ACF | |
*/ | |
// Run this function after the Gravity Form has created a post |
This file contains hidden or 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 | |
/* | |
* Enable order item thumbnail display in emails | |
* Change order item thumbnail size | |
* @see woocommerce/includes/wc-template-functions.php for hook | |
*/ | |
function edm_display_product_thumbnail_in_emails( $args ) { | |
/* Display image thumbnail in emails */ | |
$args['show_image'] = true; |
This file contains hidden or 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
/** | |
* @description Minimum, maximum, incremental and start quantity for products | WooCommerce | |
* @author Fabio Tielen / Code Agency / https://codeagency.be | |
* @testedwith WooCommerce 3.3 | |
*/ | |
add_filter( 'woocommerce_quantity_input_args', 'ca_woocommerce_quantity_increment_changes', 10, 2 ); | |
function ca_woocommerce_quantity_increment_changes( $args, $product ) { | |
if ( is_singular( 'product' ) ) { |
This file contains hidden or 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('woocommerce_before_checkout_form', 'loc_deny_checkout_user_pending_orders'); | |
function loc_deny_checkout_user_pending_orders( $posted ) { | |
global $woocommerce; | |
$customer = wp_get_current_user(); | |
if (!empty($customer)) { | |
$customer_orders = get_posts( | |
array( | |
'numberposts' => -1, | |
'meta_key' => '_customer_user', | |
'meta_value' => $customer->ID, |
This file contains hidden or 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
/** | |
* @snippet Automatically add a specific product to cart when cart amount is above certain amount | |
* @author Fabio Tielen // Code Agency // https://codeagency.be | |
* @testedwith Woo 3.3+ | |
*/ | |
add_action( 'template_redirect', 'codeagency_add_product_to_cart' ); | |
function codeagency_add_product_to_cart() { | |
if ( ! is_admin() ) { | |
global $woocommerce; |
NewerOlder