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 | |
/** | |
* Allow shortcodes in the WooCommerce Store Notice. | |
*/ | |
function modify_woocommerce_demo_store_notice_allow_shortcodes( $notice_html, $notice ) { | |
$notice_html = '<div class="woocommerce-store-notice demo_store" style="display:none;">' . do_shortcode( wp_kses_post( $notice ) ) . ' <a href="#" class="woocommerce-store-notice__dismiss-link">' . esc_html__( 'Dismiss', 'woocommerce' ) . '</a></div>'; | |
return $notice_html; | |
} | |
add_filter( 'woocommerce_demo_store', 'modify_woocommerce_demo_store_notice_allow_shortcodes', 10, 2 ); |
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 | |
/** | |
* Format WooCommerce Sale Prices for Accessibility. | |
*/ | |
function modify_woocommerce_format_sale_price( $price, $regular_price, $sale_price ) { | |
$price = '<span class="sr-only">Original price</span> <s>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</s> <span class="sr-only">sale price</span> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>'; | |
return $price; | |
} | |
add_filter( 'woocommerce_format_sale_price', 'modify_woocommerce_format_sale_price', 10, 3 ); |
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 | |
/** | |
* Turn off the WooCommerce Store Notice at a specific date and time. | |
*/ | |
function modify_woocommerce_demo_store_turn_off_date( $notice_html ) { | |
// Set the current date variable. | |
$current_date = date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ); | |
// Change this line to set the store notice end date and time variable. | |
$end_date = '2022-06-08 10:00:00'; |
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 | |
/** | |
* Show WooCommerce Store Notice to Not Logged In Visitors Only. | |
*/ | |
function modify_woocommerce_demo_store_non_users_only( $notice_html ) { | |
if ( is_user_logged_in() ) { | |
return ''; | |
} | |
return $notice_html; | |
} |
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 | |
/** | |
* Show WooCommerce Store Notice to Logged In Previous Customers Only. | |
*/ | |
function modify_woocommerce_demo_store_customers_only( $notice_html ) { | |
if ( ! is_user_logged_in() ) { | |
return ''; | |
} | |
// Get the user object. |
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 | |
/** | |
* Use Feather Icons (https://feathericons.com/) in your WordPress site. | |
* | |
* First, save a copy of feather.min.js to a custom plugin. | |
* Get it here: https://unpkg.com/feather-icons | |
* | |
*/ | |
// Enqueue the Feather script file. |
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 | |
/** | |
* Memberlite filters to set custom colors for specific pages. | |
*/ | |
// Filter the primary color on a page with the slug 'free'. | |
function my_memberlite_custom_color_primary( $current_mod ) { | |
if ( ! is_page( 'free' ) ) { | |
return $current_mod; | |
} |
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 | |
/** | |
* Add an order meta field for "Refund Reason" so admin can track | |
* why people are asking for a refund. | |
*/ | |
function my_pmpro_refund_reason_after_order_settings( $order ) { | |
if ( empty( $order->id ) ) { | |
// This is a new order. | |
return; | |
} |
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 | |
/** | |
* Filter to use the Basic User Avatar on the BuddyPress Profile. | |
*/ | |
function my_bua_bp_avatar( $image, $params ) { | |
// Determine if user has a local avatar | |
$local_avatar = get_user_meta( $params['item_id'], 'basic_user_avatar', true ); | |
if ( empty( $local_avatar ) ) { | |
return $image; |
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 | |
/** | |
* Filter to show WordPress Toolbar for Editor Role using the | |
* Hide Admin Bar From Non-Admins plugin. | |
* https://wordpress.org/plugins/hide-admin-bar-from-non-admins/ | |
* | |
*/ | |
function my_habfna_show_admin_bar_roles( $habfna_show_admin_bar_roles ) { | |
$habfna_show_admin_bar_roles[] = 'editor'; | |
return $habfna_show_admin_bar_roles; |