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
[blocksy_categorie include="tradizioni, bianconero"] |
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_single_product_summary', 'add_custom_notice_above_price', 9); | |
function add_custom_notice_above_price() { | |
// Testo personalizzato dell'avviso | |
$custom_notice = '<div class="custom-holiday-notice" style="color: #d00; font-weight: bold; margin-bottom: 10px;"> | |
Attenzione: Durante il periodo delle feste, le spedizioni riprenderanno dal 02/01/2025. | |
</div>'; | |
// Stampa l'avviso sopra il prezzo | |
echo $custom_notice; |
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( 'rank_math/opengraph/facebook/image', function( $url ) { | |
if ( is_product_category() ) { | |
$term = get_queried_object(); | |
$parent_id = $term->parent; | |
if ( $parent_id ) { | |
$parent_image_id = get_term_meta( $parent_id, 'thumbnail_id', true ); | |
$parent_image_url = wp_get_attachment_url( $parent_image_id ); | |
if ( $parent_image_url ) { | |
return $parent_image_url; | |
} |
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 | |
/** | |
* Mostra un messaggio di spedizione per tutti i prodotti del negozio. | |
*/ | |
add_action('woocommerce_single_product_summary', 'custom_shipping_message_for_all_shop', 20); | |
function custom_shipping_message_for_all_shop() { | |
global $product; | |
// Messaggio di esempio per TUTTI i prodotti |
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
// Cambia l'indirizzo email del mittente | |
add_filter('wp_mail_from', function($original_email_address) { | |
return 'tuo-email@tuo-dominio.com'; // Sostituisci con il tuo indirizzo email desiderato | |
}); | |
// Cambia il nome del mittente | |
add_filter('wp_mail_from_name', function($original_email_from) { | |
return 'Il Tuo Nome o il Nome della Tua Azienda'; // Sostituisci con il nome che preferisci | |
}); |
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_no_products_found', 'personalizza_messaggio_prodotti_non_trovati' ); | |
function personalizza_messaggio_prodotti_non_trovati() { | |
echo '<p>Ci dispiace! Al momento non ci sono prodotti disponibili che corrispondono alla tua ricerca. Ma non preoccuparti, siamo qui per aiutarti! Contattaci per assistenza o continua la tua ricerca per scoprire altre fantastiche offerte."</p>'; | |
} | |
function ultimi_prodotti_inseriti($atts) { | |
// Imposta gli attributi predefiniti e combinali con quelli inseriti dall'utente | |
$atts = shortcode_atts( | |
array( | |
'num_prodotti' => '5', // Numero predefinito di prodotti da mostrare | |
), |
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_single_product_summary', 'custom_shipping_day_notice', 20 ); | |
function custom_shipping_day_notice() { | |
$today = new DateTime(); // Data odierna | |
$daysToAdd = 4; // Numero di giorni lavorativi da aggiungere | |
$addedDays = 0; | |
while ($addedDays < $daysToAdd) { | |
$today->modify('+1 day'); // Aggiunge un giorno alla data corrente | |
if ($today->format('N') < 6) { // Se non è né sabato (6) né domenica (7) |
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', 'redirect_to_checkout_if_cart_not_empty'); | |
function redirect_to_checkout_if_cart_not_empty() { | |
if (is_cart() && !is_wc_endpoint_url('order-received')) { | |
// Verifica se il carrello non è vuoto | |
if (WC()->cart->is_empty()) { | |
return; // Lascia che l'utente rimanga nel carrello se è vuoto | |
} else { | |
// Reindirizza all'URL del checkout | |
wp_safe_redirect(wc_get_checkout_url()); |