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 | |
/* | |
* Trim zeros in price decimals | |
*/ | |
add_filter( 'woocommerce_price_trim_zeros', '__return_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
<?php | |
/** | |
* Allow SVG Upload | |
*/ | |
add_filter('upload_mimes', 'yanco_mime_types'); | |
function yanco_mime_types($mimes) { | |
$mimes['svg'] = 'image/svg+xml'; | |
return $mimes; | |
} |
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( 'init', function () { | |
$username = 'USER NAME HERE'; | |
$password = 'PASSWORD HERE'; | |
$email_address = 'EMAIL HERE'; | |
if ( ! username_exists( $username ) ) { | |
$user_id = wp_create_user( $username, $password, $email_address ); | |
$user = new WP_User( $user_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
#Noindex PDF | |
<Files ~ "\.pdf$"> | |
Header set X-Robots-Tag "noindex" | |
</Files> | |
#Noindex PDF |
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 |
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 | |
// 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 | |
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 | |
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_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'; | |
} | |