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( '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 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 | |
$the_object = array( 'your' => 'object' ); | |
print( '<pre>' . print_r( $the_object, true ) . '</pre>' ); |
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( 'woocommerce_add_to_cart_validation', 'yanco_validate_add_cart_item', 10, 5 ); | |
function yanco_validate_add_cart_item( $passed, $product_id, $quantity, $variation_id = '', $variations = '' ) { | |
$post_title = get_the_title( $product_id ); | |
// Items in cart, test if the product has already been added to the cart | |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) { |
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
UPDATE wp_posts SET post_title = LCASE( post_title ) WHERE post_type = 'product'; | |
UPDATE wp_posts SET post_title = CONCAT( UCASE( LEFT(post_title, 1) ), SUBSTRING(post_title, 2) ) WHERE post_type = 'product'; | |
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_action( 'template_redirect', 'yanco_404_redirect_to_410_for_autoptimize' ); | |
function yanco_404_redirect_to_410_for_autoptimize() { | |
if( is_404() ) { | |
$search = 'cache/autoptimize/js/autoptimize_'; | |
if( strpos( $_SERVER['REQUEST_URI'], $search ) !== false ) { | |
wp_redirect( $_SERVER['REQUEST_URI'], 410 ); | |
exit; |
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 | |
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 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 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( 'woocommerce_checkout_fields' , 'yanco_remove_woo_checkout_fields' ); | |
function yanco_remove_woo_checkout_fields( $fields ) { | |
// remove billing fields | |
unset( $fields['billing']['billing_company'] ); | |
unset( $fields['billing']['billing_address_2'] ); | |
// remove order comment fields | |
// unset($fields['order']['order_comments']); | |
return $fields; |
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
total.toLocaleString("da-DK", { | |
style: "currency", | |
currency: "DKK" | |
}); |
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 | |
// Modify the fields to search in | |
add_action( 'elementor/query/searched_query', function( $query ) { | |
$s = get_search_query(); | |
if ( is_search() ) { | |
$query->set( 'post_type', 'leverandor' ); | |
if( strlen($s) >= 3 ) { |