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 | |
/** | |
* Block: Map | |
* Description: Generates a static map image via Google Static Maps API. | |
* | |
* @see https://staticmapmaker.com/google/ | |
* @see https://github.com/getblocklab/block-lab | |
* ---------------------------------------- | |
* Block config: | |
* ---------------------------------------- |
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
//Register the product custom field | |
add_action( 'woocommerce_product_options_inventory_product_data', 'my_woocommerce_product_subheading' ); | |
function my_woocommerce_product_subheading() { | |
$args = array( | |
'label' => 'Produkt-Untertitel', // Text in Label | |
'placeholder' => 'Produkt-Untertitel', | |
'id' => 'product_subheading', // required | |
'name' => 'product_subheading', | |
'desc_tip' => 'Produkt-Untertitel eingeben', |
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_action('after_setup_theme', 'remove_admin_bar'); | |
function remove_admin_bar() { | |
if (!current_user_can('administrator') && !is_admin()) { | |
show_admin_bar(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
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 ); | |
function woo_remove_product_tabs( $tabs ) { | |
// unset( $tabs['description'] ); // Remove the description tab | |
// unset( $tabs['reviews'] ); // Remove the reviews tab | |
// unset( $tabs['additional_information'] ); // Remove the additional information tab | |
return $tabs; | |
} |
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 checkout fields | |
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); | |
function custom_override_checkout_fields( $fields ) { | |
// remove billing fields | |
// unset($fields['billing']['billing_first_name']); // Billing First name | |
// unset($fields['billing']['billing_last_name']); // Billing Last name | |
// unset($fields['billing']['billing_company']); // Billing company | |
// unset($fields['billing']['billing_address_1']); // Billing Address 1 | |
// unset($fields['billing']['billing_address_2']); // Billing Address 2 |
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
function activate_gutenberg_product( $can_edit, $post_type ) { | |
if ( $post_type == 'product' ) { | |
$can_edit = true; | |
} | |
return $can_edit; | |
} | |
add_filter( 'use_block_editor_for_post_type', 'activate_gutenberg_product', 10, 2 ); | |
// enable taxonomy fields for woocommerce with gutenberg on | |
function enable_taxonomy_rest( $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
add_action( 'template_redirect', function() { | |
// Replace "cart" and "checkout" with cart and checkout page slug if needed | |
if ( is_page( 'cart' ) ) { | |
wp_redirect( '/checkout/' ); | |
die(); | |
} | |
} ); | |
add_action( 'template_redirect', 'redirect_empty_checkout' ); |
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_action( 'woocommerce_product_query', 'out_of_stock_last', 999 ); | |
function out_of_stock_last( $query ) { | |
if ( is_admin() ) return; | |
$query->set( 'meta_key', '_stock_status' ); | |
$query->set( 'orderby', array( 'meta_value' => 'ASC' ) ); | |
} |
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_shortcode( 'wpse_comments_template', function( $atts = array(), $content = '' ) | |
{ if( is_singular() && post_type_supports( get_post_type(), 'comments' ) ) | |
{ | |
ob_start(); | |
comments_template(); | |
return ob_get_clean(); | |
} | |
return ''; | |
}, 10, 2 ); |
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( 'woocommerce_subcategory_count_html', '__return_false' ); |
OlderNewer