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 privacy policy tick box at checkout | |
*/ | |
add_action( 'woocommerce_review_order_before_submit', 'yanco_add_checkout_privacy_policy', 9 ); | |
function yanco_add_checkout_privacy_policy() { | |
woocommerce_form_field( 'privacy_policy', array( | |
'type' => 'checkbox', | |
'class' => array('form-row privacy'), |
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_action('woocommerce_subscription_status_pending-cancel', 'yanco_woocommerce_subscription_status_pending_cancel', 10, 3 ); | |
function yanco_woocommerce_subscription_status_pending_cancel( $subscription ) { | |
$customer_email = $subscription->get_billing_email(); | |
$wc_emails = WC()->mailer()->get_emails(); | |
$admin_email = $wc_emails['WCS_Email_Cancelled_Subscription']->recipient; | |
$wc_emails['WCS_Email_Cancelled_Subscription']->trigger( $subscription ); |
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 | |
/* | |
* Adjust the interval that the feed file is generated. | |
*/ | |
add_filter( 'wc_facebook_feed_generation_interval', 'yanco_wc_facebook_feed_generation_interval', 10, 1 ); | |
function yanco_wc_facebook_feed_generation_interval( $interval ) { | |
return 60 * 30; | |
} |
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 | |
// Disable Ready Only for Administrators | |
// add_filter( 'acf/load_field', 'yanco_acf_disable_read_only', 10000 ); | |
function yanco_acf_disable_read_only( $field ) { | |
// Applies to administrators | |
if( is_admin() && get_post_type() == 'afrapportering' ) { | |
global $pagenow; | |
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_filter( 'enter_title_here', 'yanco_change_title_text' ); | |
function yanco_change_title_text( $title ){ | |
$screen = get_current_screen(); | |
if ( 'leverandor' == $screen->post_type ) { | |
$title = 'Virksomhedsnavn'; | |
} | |
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 | |
function yanco_defer_script_loader_tag( $tag, $handle, $src ) { | |
$defer = array( | |
'magnific-popup', | |
'cycle', | |
'script' | |
); | |
if ( in_array( $handle, $defer ) ) { | |
return '<script src="' . $src . '" defer="defer" type="text/javascript"></script>' . "\n"; |
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_action( 'woocommerce_before_shop_loop', 'yanco_products_per_page_selectbox', 25 ); | |
function yanco_products_per_page_selectbox() { | |
$html = ''; | |
$style = 'font-size: 16px; | |
font-weight: 300; | |
font-family: inherit; | |
letter-spacing: 1px; |
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 | |
// define( 'ONE_MB', 1024 ); // 1 * 1024 | |
// define( 'TWENTYFIVE_MB', 26214400 ); // 25 * 1024 | |
// define( 'TWENTYFOUR_MB', 25165824 ); // 24 * 1025 | |
define( 'LARGE_NOTIFICATIONS_ATTACHMENT_LIMIT_IN_BYTES', 25165824 ); // 24 * 1025 = 24MB | |
add_filter( 'gform_notification', 'yanco_filter_large_notification_attachments', 10, 3 ); | |
function yanco_filter_large_notification_attachments( $notification, $form, $entry ) { |
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 | |
// From https://remicorson.com/mastering-woocommerce-products-custom-fields/ | |
// Display Fields | |
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' ); | |
// Save Fields | |
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' ); |
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 | |
function yanco_has_active_subscription( $user_id = '' ) { | |
if( function_exists( 'wcs_user_has_subscription' ) ) { | |
// When a $user_id is not specified, get the current user Id | |
if( '' == $user_id && is_user_logged_in() ) { | |
$user_id = get_current_user_id(); | |
} | |
// User not logged in we return false |
NewerOlder