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
/** | |
* Clears WC Cart on Page Load | |
* (Only when not on cart/checkout page) | |
*/ | |
add_action( 'wp_head', 'bryce_clear_cart' ); | |
function bryce_clear_cart() { | |
if ( wc_get_page_id( 'cart' ) == get_the_ID() || wc_get_page_id( 'checkout' ) == get_the_ID() ) { | |
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
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)') { | |
var windowPrefersDark = window.matchMedia('(prefers-color-scheme: dark)'); | |
var systemColorMode = windowPrefersDark.matches ? 'dark' : 'light'; | |
// need to check in case doesn't exist like with Safari 13.x | |
if ( | |
'addEventListener' in windowPrefersDark && | |
typeof windowPrefersDark.addEventListener === 'function' | |
) { | |
windowPrefersDark.addEventListener('change', (event) => { |
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
:root.dark { | |
color-scheme: light dark; | |
} |
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
if (color_mode == 'dark') { | |
document.body.classList.add('dark'); | |
document.documentElement.classList.add('dark'); | |
} else { | |
document.body.classList.remove('dark'); | |
document.documentElement.classList.remove('dark'); | |
} |
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
const dark = window.matchMedia && | |
window.matchMedia('(prefers-color-scheme: dark)') && | |
window.matchMedia('(prefers-color-scheme: dark)').matches; |
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
<body class="dark"> | |
my app | |
</body> |
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
@media (prefers-color-scheme: dark) { | |
background: black; | |
} |
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_filter( 'submit_job_form_login_url', 'wpjms_redirect_login_url' ); | |
function wpjms_redirect_login_url() { | |
return 'http://mysite.com/my-account/'; | |
} |
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_filter( 'get_user_metadata', 'mtkdocs_filter_user_metadata', 10, 4 ); | |
function mtkdocs_filter_user_metadata( $value, $object_id, $meta_key, $single ) { | |
// Check if it's one of the keys we want to filter | |
if ( in_array( $meta_key, array( '_money_spent', '_order_count' ) ) ) { | |
// Return 0 so WC doesn't try calculate it | |
return 0; | |
} | |
// Default |
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 | |
/* | |
Plugin Name: Stop Multiple WooCommerce Coupons | |
Plugin URI: https://metorik.com | |
Description: Only allow individual use coupons in WooCommerce, even if they have not been set as such. | |
Version: 1.0.0 | |
Author: Bryce Adams (Metorik) | |
Author URI: https://metorik.com | |
Text Domain: stop-multiple-woocommerce-coupons-metorik | |
*/ |
NewerOlder