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 the product skus with the number that is gathered from the Product Title. SKU is in parentheses | |
// Make it available as an admin page | |
function update_product_skus() { | |
$args = array( | |
'post_type' => 'product', | |
'posts_per_page' => -1, // Retrieve all products; adjust if needed | |
); | |
$products = get_posts($args); |
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 | |
// Tweak the logout function to redirect to home page after logging out | |
add_action('wp_logout','auto_redirect_after_logout'); | |
function auto_redirect_after_logout(){ | |
wp_safe_redirect( home_url() ); | |
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 get_user_geo_country(){ | |
if(is_checkout()) { | |
$geo = new WC_Geolocation(); // Get WC_Geolocation instance object | |
$user_ip = $geo->get_ip_address(); // Get user IP | |
$user_geo = $geo->geolocate_ip( $user_ip ); // Get geolocated user data. | |
$country = $user_geo['country']; // Get the country code | |
if($country != 'DE') { | |
?> |
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
// Remove product count from category listing | |
add_filter( 'woocommerce_subcategory_count_html', '__return_false' ); |
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 | |
/** | |
* Override loop template and show quantity and quantity buttons next to add to cart buttons | |
*/ | |
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 ); | |
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) { | |
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) { | |
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">'; | |
$html .= woocommerce_quantity_input( array(), $product, false ); |
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_shortcode('check_if_scraper_plugin_is_active', function() { | |
if(is_plugin_active('product-scraper/product-scraper.php')) { | |
return true; | |
} else { | |
return false; | |
} | |
}); |
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
// Make Custom Field Readonly | |
function make_price_field_readonly($field) { | |
$field['readonly'] = true; | |
return $field; | |
} | |
add_filter('acf/prepare_field/name=price_field_name', 'make_price_field_readonly'); |
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
// REMOVE TAB TITLES ON SINGLE PRODUCT TEMPLATE | |
// Remove Description Title from Single Product Page Tabs | |
add_filter('woocommerce_product_description_heading', '__return_null'); | |
// Remove Additional Information Title from Single Product Page Tabs | |
add_filter('woocommerce_product_additional_information_heading', '__return_null'); | |
// Remove Reviews Title from Single Product Page Tabs | |
add_filter('woocommerce_reviews_title', '__return_null'); |
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
// Wordpress Default Font Sizes - Overriding them using theme.json is encouraged. | |
// See the theme.json to see how to override the default font size values in another gist | |
// Sizes in pixels | |
--wp--preset--font-size--small: 13px; | |
--wp--preset--font-size--medium: 20px; | |
--wp--preset--font-size--large: 36px; | |
--wp--preset--font-size--x-large: 42px; | |
// Sizes in rem | |
--wp--preset--font-size--small: 0.75rem; |
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
{ | |
"$schema": "https://schemas.wp.org/trunk/theme.json", | |
"version": 2, | |
"settings": { | |
"typography": { | |
"fontFamilies": [ | |
{ "fontFamily": "Rubik, sans-serif", "slug": "devforwp-rubik", "name": "DevForWp Rubik" } | |
], | |
"fontSizes": [ | |
{ "slug": "small", "size": "0.75rem", "name": "Small" }, |
NewerOlder