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 | |
/** | |
* Load datepicker script for specific pages. | |
*/ | |
function load_my_jquery_datepicker_script_for_pmpro() { | |
global $pmpro_pages; | |
if ( is_page( array( $pmpro_pages['checkout'], $pmpro_pages['member_profile_edit'] ) ) || | |
defined( 'IS_PROFILE_PAGE' ) || | |
( is_admin() && |
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 | |
/** | |
* Add column to show all posts a reusable block is used in. | |
*/ | |
function my_reusable_blocks_screen_add_column( $columns ) { | |
$columns['posts_used_in'] = esc_html__( 'Used In', 'textdomain' ); | |
return $columns; | |
} | |
add_filter( 'manage_wp_block_posts_columns', 'my_reusable_blocks_screen_add_column' ); |
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 | |
/** | |
* Add additional colors to the Block Editor color palette. | |
* Update and insert additional colors into the $new_colors array. | |
* | |
*/ | |
function my_custom_editor_color_palette_extended() { | |
$editor_settings = get_block_editor_settings( array(), 'core/edit-post' ); | |
$new_colors = array( | |
array( |
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 | |
/** | |
* Add colors to block editor color palette. | |
* | |
*/ | |
function my_custom_colors_block_editor( $editor_settings, $editor_context ) { | |
$my_custom_colors = array( | |
array( | |
'name' => __( 'New Color 1', 'textdomain' ), | |
'slug' => 'my-new-color-1', |
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 | |
/** | |
* Remove subscription delay for existing/past members. | |
*/ | |
function my_pmpro_remove_subscription_delay_for_renewals() { | |
if ( is_admin() || ! is_user_logged_in() ) { | |
return; | |
} | |
$order = new MemberOrder(); |
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 | |
/** | |
* Always add my single product by ID to the cart if it isn't already there. | |
*/ | |
function my_woocommerce_force_add_product_to_cart() { | |
$product_id = 325; | |
$product_cart_id = WC()->cart->generate_cart_id( $product_id ); | |
if ( ! WC()->cart->find_product_in_cart( $product_cart_id ) ) { | |
// Yep, the product with ID is NOT in the cart, let's add it then! | |
WC()->cart->add_to_cart( $product_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
<?php | |
/** | |
* Hide the Discount Code field on Easy Digital Downloads checkout. | |
* Customers can only apply coupons using a URL attribute like: | |
* http://sitewidesales.local/checkout/?discount=loyal. | |
*/ | |
function my_edd_no_discount_code_on_checkout() { | |
remove_action( 'edd_checkout_form_top', 'edd_discount_field', -1 ); | |
} | |
add_action( 'init', 'my_edd_no_discount_code_on_checkout' ); |