Files
torebki-fabiola.pl/wp-content/themes/dotspice/functions.php
2026-03-05 13:07:40 +01:00

649 lines
23 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Dotspice functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Dotspice
* @version 1.3.0
*/
define('DOTSPICE_SLIDER_SWIPER_ENABLE', true);
define('DOTSPICE_MAP_GOOGLE_ENABLE', true);
add_action( wp_default_scripts, function( $scripts ) {
if ( ! empty( $scripts->registered[jquery] ) ) {
$scripts->registered[jquery]->deps = array_diff( $scripts->registered[jquery]->deps, array( jquery-migrate ) );
}
} );
/**
* Require theme functions
*/
require_once get_template_directory() . '/includes/core/init.php';
/**
* Sets up theme defaults features.
*/
function dotspice_setup()
{
// Automatic Feed Links
add_theme_support('automatic-feed-links');
// Title tag
add_theme_support('title-tag');
// Featured Images
add_theme_support('post-thumbnails');
add_action('init', 'dotspice_heartbeat_setup');
// HTML5 Semantic Markup
add_theme_support('html5', array('comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'script', 'style'));
// Translation
load_theme_textdomain('dotspice', get_template_directory() . '/languages');
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array(
'primary' => esc_html__('Primary', 'dotspice'),
'additional' => esc_html__('Additional', 'dotspice'),
));
// Thumbnails Crop
if (!get_option('medium_crop')) {
update_option('medium_crop', 1);
update_option('large_crop', 1);
}
// Set the content width
if (!isset($content_width)) {
$content_width = 1170;
}
}
function dotspice_heartbeat_setup()
{
// Sprawdź czy użytkownik jest administratorem
if (current_user_can('administrator')) {
// Ustaw interwał odświeżania na 15 sekund (możesz dostosować wartość według swoich potrzeb)
add_filter('heartbeat_settings', function ($settings) {
$settings['interval'] = 15;
return $settings;
});
}
}
// Wywołaj funkcję dotspice_setup()
//add_action('after_setup_theme', 'dotspice_setup');
add_action('after_setup_theme', 'dotspice_setup');
/**
* Include Sripts & Styles
*/
function dotspice_scripts()
{
// Enqueue Scripts
wp_enqueue_script('jquery');
wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true);
wp_enqueue_script('aos-js', get_template_directory_uri() . '/js/aos.min.js', array('jquery'), '', true);
wp_enqueue_script('owl-carousel-js', get_template_directory_uri() . '/js/owl.carousel.min.js', array('jquery'), '', true);
wp_enqueue_script('simpleParallax-js', get_template_directory_uri() . '/js/simpleParallax.min.js', array('jquery'), '', true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
if (dotspice_get_theme_option('header_sticky', 'none') != 'none') {
wp_enqueue_script('sticky-header', get_template_directory_uri() . '/js/sticky-header.js', array(), filemtime(get_template_directory() . '/js/sticky-header.js'), true);
}
if (dotspice_has_shortcode('gallery')) {
wp_enqueue_script('magnific-popup', get_template_directory_uri() . '/js/jquery.magnific-popup.min.js', array('jquery'), '', true);
}
wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js', array(), filemtime(get_template_directory() . '/js/script.js'), true);
// Dequeue Styles
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wc-block-style');
wp_dequeue_style('cookie-consent-style');
// Enqueue Fonts
foreach (dotspice_get_theme_option('fonts', array()) as $font_key => $font_value) {
if (!empty($font_value)) {
wp_enqueue_style(esc_attr($font_key) . '-fonts', $font_value, array(), null);
}
}
// Enqueue Styles
if (dotspice_has_shortcode('gallery')) {
wp_enqueue_style('magnific-popup', get_template_directory_uri() . '/css/magnific-popup.min.css', array(), null);
}
wp_enqueue_style('style', get_template_directory_uri() . '/css/style.css', array(), filemtime(get_template_directory() . '/css/style.css'));
wp_enqueue_style('owl-carousel', get_template_directory_uri() . '/css/owl.carousel.min.css', array(), filemtime(get_template_directory() . '/css/owl.carousel.min.css'));
}
add_action('wp_enqueue_scripts', 'dotspice_scripts');
/**
* Register Widgets Areas
*/
function dotspice_widgets_init()
{
$theme_sidebars = array(
'before-header' => array('tag' => false, 'name' => esc_html__('Before Header', 'dotspice')),
'jumbotron' => array('tag' => false, 'name' => esc_html__('Jumbotron', 'dotspice')),
'sidebar' => array('tag' => 'div', 'name' => esc_html__('Sidebar', 'dotspice')),
'footer' => array('tag' => false, 'name' => esc_html__('Footer', 'dotspice')),
'footer-area-1' => array('tag' => 'div', 'name' => sprintf(esc_html__('Footer Area %s', 'dotspice'), 1)),
'footer-area-2' => array('tag' => 'div', 'name' => sprintf(esc_html__('Footer Area %s', 'dotspice'), 2)),
'footer-area-3' => array('tag' => 'div', 'name' => sprintf(esc_html__('Footer Area %s', 'dotspice'), 3)),
'footer-area-4' => array('tag' => 'div', 'name' => sprintf(esc_html__('Footer Area %s', 'dotspice'), 4)),
'footer-copy' => array('tag' => false, 'name' => esc_html__('Footer Copyright', 'dotspice')),
);
if (class_exists('woocommerce')) {
$theme_sidebars = array_merge($theme_sidebars, array(
'shop-sidebar' => array('tag' => 'h3', 'name' => esc_html__('Shop Sidebar', 'dotspice')),
'shop-before-content' => array('tag' => false, 'name' => esc_html__('Shop Before Content', 'dotspice')),
'shop-after-content' => array('tag' => false, 'name' => esc_html__('Shop After Content', 'dotspice')),
));
}
foreach ($theme_sidebars as $sidebar_ID => $sidebar_data) {
register_sidebar(array(
'name' => $sidebar_data['name'],
'id' => $sidebar_ID,
'description' => esc_html__('Add widgets here.', 'dotspice'),
'before_widget' => ($sidebar_data['tag']) ? '<section id="%1$s" class="widget %2$s">' : '',
'after_widget' => ($sidebar_data['tag']) ? '</section>' : '',
'before_title' => ($sidebar_data['tag']) ? '<' . $sidebar_data['tag'] . ' class="widget-title">' : '',
'after_title' => ($sidebar_data['tag']) ? '</' . $sidebar_data['tag'] . '>' : '',
));
}
}
add_action('widgets_init', 'dotspice_widgets_init');
/**
* Paste your code here
*/
add_filter('gutenberg_use_widgets_block_editor', '__return_false');
add_filter('use_widgets_block_editor', '__return_false');
function dotspice_remove_p_tags($content)
{
if (is_singular('page')) {
remove_filter('the_content', 'wpautop');
remove_filter('the_excerpt', 'wpautop');
}
return $content;
}
add_filter('the_content', 'dotspice_remove_p_tags', 0);
/**
* Classic widget
*/
add_filter('gutenberg_use_widgets_block_editor', '__return_false');
add_filter('use_widgets_block_editor', '__return_false');
/**
* Wordpress change footer text
*/
function remove_footer_admin()
{
echo 'Dotspice.com';
}
add_filter('admin_footer_text', 'remove_footer_admin');
/**
* Disable xmlrpc.php
*/
add_filter('xmlrpc_enabled', '__return_false');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
function my_acf_init()
{
acf_update_setting('select2_version', 4);
}
add_action('acf/init', 'my_acf_init');
add_filter('manage_edit-shop_order_columns', 'show_product_order', 15);
function show_product_order($columns)
{
//add column
$columns['product-display'] = __('Produkty');
return $columns;
}
add_action('manage_shop_order_posts_custom_column', 'snv_custom_shop_order_column', 10, 2);
function snv_custom_shop_order_column($column)
{
global $post, $woocommerce, $the_order;
switch ($column) {
case 'product-display':
$terms = $the_order->get_items();
if (is_array($terms)) {
foreach ($terms as $term) {
echo $term['item_meta']['_qty'][0] . ' <font color="red">x</font> ' . $term['name'] . '';
}
} else {
_e('Nie można uzyskać produktów?', 'woocommerce');
}
break;
}
}
//style statusow
add_action('admin_head', 'statusy');
function statusy()
{
echo '<style>
.status-wykrojone {
background: blue;
color: white;
}
.status-pilne {
background: red;
color: white;
}
.status-uszyte {
background: #fa37dd;
color: #000;
}
</style>';
}
//cookies
setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
if (SITECOOKIEPATH != COOKIEPATH) setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
add_action('woocommerce_order_status_processing', 'pracownia');
function pracownia($order_id)
{
// Lets grab the order
$order = new WC_Order($order_id);
$order_number = $order->get_order_number();
/**
* Put your tracking code here
* You can get the order total etc e.g. $order->get_total();
*/
// This is the order total
$order->get_total();
// This is how to grab line items from the order
$line_items = $order->get_items();
// This loops over line items
foreach ($line_items as $item) {
// This will be a product
$product = $order->get_product_from_item($item);
$email = urlencode($order->get_billing_email());
$phone = urlencode($order->get_billing_phone());
// This is the products SKU
$sku = $product->get_sku();
// This is the qty purchased
$qty = $item->get_quantity();
// Line item total cost including taxes and rounded
$total = $order->get_line_total($item, true, true);
// Line item subtotal (before discounts)
$subtotal = $order->get_line_subtotal($item, true, true);
$product_name = urlencode($item->get_name());
$comment = urlencode($order->customer_message);
$product_id = $item['product_id'];
$cat = get_post_meta($product_id, '_yoast_wpseo_primary_product_cat', true);
$meta = "";
$item_id = $item->get_ID();
$commentpro = urlencode(wc_get_order_item_meta($item_id, 'Wpisz kolor i rodzaj skóry (sprawdź wzornik) oraz ewentualne szczegóły Twojego zamówienia:', true));
$skora = urlencode(wc_get_order_item_meta($item_id, 'Wpisz kolor i rodzaj skóry (sprawdź wzornik)', true));
$pasek = urlencode(wc_get_order_item_meta($item_id, 'Pasek', true));
$okucia = urlencode(wc_get_order_item_meta($item_id, 'Kolor okuć', true));
$podszewka = urlencode(wc_get_order_item_meta($item_id, 'Kolor podszewki', true));
$inicjaly = urlencode(wc_get_order_item_meta($item_id, 'Personalizacja - FABIOLA handmade for XXXXXXXXXX (do 10 liter- znaków)', true));
$img_string = wc_get_order_item_meta($item_id, 'Dodaj plik', true);
$dodatkowypasek_string = wc_get_order_item_meta($item_id, 'Dodatkowy pasek lub rączka', true);
$dodatkowypasek_s = explode("|", $dodatkowypasek_string);
$dodatkowypasek = urlencode($dodatkowypasek_s[0]);
$dodatkowypasek_string2 = wc_get_order_item_meta($item_id, 'Dodatkowy pasek', true);
$dodatkowypasek_s2 = explode("|", $dodatkowypasek_string2);
$dodatkowypasek2 = urlencode($dodatkowypasek_s2[0]);
$raczka_string = wc_get_order_item_meta($item_id, 'Rączka', true);
$raczka_s = explode("|", $raczka_string);
$raczka = urlencode($raczka_s[0]);
$dodatkowypasekdlugosc = urlencode(wc_get_order_item_meta($item_id, 'Może chcesz zmienić długość? ', true));
$img_s = explode("|", $img_string);
$img = urlencode($img_s[1]);
$days_string = wc_get_order_item_meta($item_id, 'Planowana data wysyłki', true);
$days_s = explode("|", $days_string);
$days_clean = trim(str_replace(['"', '\\'], '', $days_s[0]));
$days = urlencode($days_clean);
$grawer_string = wc_get_order_item_meta($item_id, 'Grawer laserowy', true);
$grawer_string2 = $grawer_string;
if(!$grawer_string || strpos($grawer_string, 'Bez graweru') !==false || strpos($grawer_string2, 'Brak graweru')!==false) {
$grawer = 0;
} else {
$grawer = 1;
}
$x = 1;
while ($x <= $qty) {
if($cat!=2288) {
echo file_get_contents("http://pracownia.torebki-fabiola.pl/api.php?key=4c40a73650c6a3d3a81c56e6a09a031d&order_id=" . $order_number . "&itemid=" . $item_id . "&product_name=" . $product_name . "&cat=" . $cat . "&comment=" . $comment . "&email=" . $email . "&phone=" . $phone . "&img=" . $img . "&days=" . $days . "&grawer=" . $grawer . "");
}
if ($dodatkowypasek && $dodatkowypasek != "Nie " && $dodatkowypasek != "Nie" && $dodatkowypasek != "Nie+" && $dodatkowypasek != "NIE " && $dodatkowypasek != "NIE+" && $dodatkowypasek != " BEZ PASKA" && $dodatkowypasek != "+BEZ PASKA") {
echo file_get_contents("http://pracownia.torebki-fabiola.pl/api.php?key=4c40a73650c6a3d3a81c56e6a09a031d&order_id=" . $order_number . "&itemid=" . $item_id . "&product_name=" . $dodatkowypasek . "&cat=308&comment=" . $comment . "&email=" . $email . "&phone=" . $phone . "&img=" . $img . "&dlugoscpaska=" . $dodatkowypasekdlugosc . "&namemain=" . $product_name . "&days=" . $days . "&grawer=" . $grawer . "");
}
if ($dodatkowypasek2 && $dodatkowypasek2 != "Nie " && $dodatkowypasek2 != "Nie" && $dodatkowypasek2 != "Nie+" && $dodatkowypasek2 != "NIE " && $dodatkowypasek2 != "NIE+"&& $dodatkowypasek2 != " BEZ PASKA" && $dodatkowypasek2 != "+BEZ PASKA") {
echo file_get_contents("http://pracownia.torebki-fabiola.pl/api.php?key=4c40a73650c6a3d3a81c56e6a09a031d&order_id=" . $order_number . "&itemid=" . $item_id . "&product_name=" . $dodatkowypasek2 . "&cat=308&comment=" . $comment . "&email=" . $email . "&phone=" . $phone . "&img=" . $img . "&dlugoscpaska=" . $dodatkowypasekdlugosc . "&namemain=" . $product_name . "&days=" . $days . "&grawer=" . $grawer . "");
}
if ($raczka && $raczka != "Nie " && $raczka != "Nie" && $raczka != "Nie+" && $raczka != "Nie " && $raczka != "Nie++" && $raczka != "NIE " && $raczka != "NIE+") {
echo file_get_contents("http://pracownia.torebki-fabiola.pl/api.php?key=4c40a73650c6a3d3a81c56e6a09a031d&order_id=" . $order_number . "&itemid=" . $item_id . "&product_name=" . $raczka . "&cat=1599&comment=" . $comment . "&email=" . $email . "&phone=" . $phone . "&img=" . $img . "&namemain=" . $product_name . "&days=" . $days . "&grawer=" . $grawer . "");
}
$x++;
}
}
}
add_filter('manage_edit-shop_order_columns', 'custom_shop_order_column', 11);
function custom_shop_order_column($columns)
{
$columns['my-column1'] = __('Skąd', 'theme_slug');
return $columns;
}
add_action('manage_shop_order_posts_custom_column', 'custom_orders_list_column_content', 10, 2);
function custom_orders_list_column_content($column)
{
global $post, $woocommerce, $the_order;
$order_id = $the_order->id;
switch ($column) {
case 'my-column1':
$myVarOne = get_post_meta($order_id, 'aaa_from', true);
if ($myVarOne != "") {
echo "<b>" . $myVarOne . "</b>";
} else {
echo "WP";
}
break;
}
}
/* This snippet removes the action that inserts thumbnails to products in teh loop
* and re-adds the function customized with our wrapper in it.
* It applies to all archives with products.
*
* @original plugin: WooCommerce
* @author of snippet: Brian Krogsard
*/
remove_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
add_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
/**
* WooCommerce Loop Product Thumbs
**/
if (!function_exists('woocommerce_template_loop_product_thumbnail')) {
function woocommerce_template_loop_product_thumbnail()
{
echo woocommerce_get_product_thumbnail();
}
}
/**
* WooCommerce Product Thumbnail
**/
if (!function_exists('woocommerce_get_product_thumbnail')) {
function woocommerce_get_product_thumbnail($size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0)
{
global $post, $woocommerce;
$output = '<div class="imagewrapper">';
if (has_post_thumbnail()) {
$output .= get_the_post_thumbnail($post->ID, $size);
} else {
$output .= '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" />';
}
$output .= '</div>';
return $output;
}
}
function get_cookies($paras = '', $content = '')
{
if (strtolower($paras[0]) == 'novalue') {
$novalue = true;
} else {
$novalue = false;
}
if ($content == '') {
$seperator = ' : ';
} else {
$seperator = $content;
}
$cookie = $_COOKIE;
ksort($cookie);
$content = "<ul>n";
foreach ($cookie as $key => $val) {
$content .= '<li>' . $key;
if (!$novalue) {
$content .= $seperator . $val;
}
$content .= "</li>n";
}
$content .= "</ul>n";
return do_shortcode($content);
}
add_shortcode('cookies', 'get_cookies');
function my_custom_available_payment_gateways($gateways)
{
$chosen_shipping_rates = (isset(WC()->session)) ? WC()->session->get('chosen_shipping_methods') : array();
if (isset($chosen_shipping_rates) && is_array($chosen_shipping_rates)) {
if (in_array('flexible_shipping_single:29', $chosen_shipping_rates) || in_array('flexible_shipping_single:27', $chosen_shipping_rates)) {
unset($gateways['cod']);
} elseif (in_array('flexible_shipping_single:28', $chosen_shipping_rates)) {
unset($gateways['bacs']);
unset($gateways['cheque']);
unset($gateways['paypal']);
unset($gateways['przelewy24']);
unset($gateways['wc_montonio_payments']);
unset($gateways['wc_montonio_card']);
unset($gateways['wc_montonio_blik']);
unset($gateways['payucreditcard']);
unset($gateways['payulistbanks']);
unset($gateways['payustandard']);
unset($gateways['payusecureform']);
unset($gateways['payublik']);
unset($gateways['payupaypo']);
unset($gateways['transferuj']);
} elseif (in_array('flexible_shipping_single:32', $chosen_shipping_rates)) {
unset($gateways['bacs']);
unset($gateways['cheque']);
unset($gateways['paypal']);
unset($gateways['przelewy24']);
unset($gateways['wc_montonio_payments']);
unset($gateways['wc_montonio_card']);
unset($gateways['wc_montonio_blik']);
unset($gateways['payucreditcard']);
unset($gateways['payulistbanks']);
unset($gateways['payustandard']);
unset($gateways['payusecureform']);
unset($gateways['payublik']);
unset($gateways['payupaypo']);
unset($gateways['transferuj']);
} elseif (in_array('flexible_shipping_single:25', $chosen_shipping_rates)) {
unset($gateways['cod']);
} elseif (in_array('flexible_shipping_single:29', $chosen_shipping_rates)) {
unset($gateways['cod']);
} elseif (in_array('flexible_shipping_single:31', $chosen_shipping_rates)) {
unset($gateways['cod']);
} elseif (in_array('flexible_shipping_single:27', $chosen_shipping_rates)) {
unset($gateways['cod']);
}
}
return $gateways;
}
add_filter('woocommerce_available_payment_gateways', 'my_custom_available_payment_gateways');
function payment_gateway_disable_country($available_gateways)
{
global $woocommerce;
if (isset($available_gateways['cod']) && $woocommerce->customer->get_country() <> 'PL') {
unset($available_gateways['cod']);
}
return $available_gateways;
}
add_filter('woocommerce_available_payment_gateways', 'payment_gateway_disable_country');
add_action('woocommerce_email_before_order_table', 'fabiola_add_content_specific_email', 20, 4);
function fabiola_add_content_specific_email($order, $sent_to_admin, $plain_text, $email)
{
if ($email->id == 'customer_processing_order') {
echo '<h2 class="email-upsell-title">Śledzenie zamówienia</h2><p class="email-upsell-p">Możesz śledzić proces tworzenia Twojego zamówienia na bieżąco pod tym adresem: <a href="https://pracownia.torebki-fabiola.pl/tracking.php?order=' . $order->get_order_number() . '&email=' . $order->get_billing_email() . '">https://pracownia.torebki-fabiola.pl/tracking.php?order=' . $order->get_order_number() . '&email=' . $order->get_billing_email() . '</a><br></p>';
}
}
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;
}
// Insert additional information into description tab
add_filter('woocommerce_product_tabs', function ($tabs) {
$tabs['description']['callback'] = function () {
global $product;
wc_get_template('single-product/tabs/description.php');
if ($product && ($product->has_attributes() || apply_filters('wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions()))) {
wc_get_template('single-product/tabs/additional-information.php');
}
};
return $tabs;
}, 98);
add_filter('woocommerce_product_description_heading', 'bbloomer_rename_description_tab_heading');
function bbloomer_rename_description_tab_heading()
{
return 'Więcej informacji';
}
add_action('woocommerce_thankyou', 'my_custom_tracking');
function my_custom_tracking($order_id)
{
$order = wc_get_order($order_id);
$total = $order->get_subtotal();
$order_num = str_replace('#', '', $order->get_order_number());
echo '<iframe src="https://tracking.bonusway.com/aff_l?offer_id=956&amount=' . $total . '&adv_sub=' . $order_num . '" scrolling="no" frameborder="0" width="1" height="1"></iframe>';
}
add_filter('woocommerce_get_price_html', 'bbloomer_price_free_zero_empty', 9999, 2);
function bbloomer_price_free_zero_empty($price, $product)
{
if ('' === $product->get_price() || 0 == $product->get_price()) {
$price = '<span class="woocommerce-Price-amount amount" style="display:none;">0</span>';
}
return $price;
}
/**
* Change number of products that are displayed per page (shop page)
*/
add_filter('loop_shop_per_page', 'wc_redefine_products_per_page', 9999);
function wc_redefine_products_per_page($per_page)
{
$per_page = 12;
return $per_page;
}
add_action('woocommerce_archive_description', 'custom_archive_description', 2);
function custom_archive_description()
{
if (is_product_category()) :
remove_action('woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10);
add_action('woocommerce_after_main_content', 'woocommerce_taxonomy_archive_description', 5);
endif;
}
/**
* Custom post type for "Nagrody Gwiazdy Prasa"
*/
function dotspice_add_custom_post_types()
{
// Product
register_post_type('galeria_nagrody', array(
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 5,
'menu_icon' => 'dashicons-admin-post',
'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
'labels' => array(
'name' => 'Nagrody / Prasa / Gwiazdy',
'singular_name' => 'Nagrody / Prasa / Gwiazdy',
'menu_name' => 'Nagrody / Prasa / Gwiazdy'
),
));
}
add_action('init', 'dotspice_add_custom_post_types');
add_action( 'woocommerce_after_add_to_cart_form', 'dotspice_below_single_product_summary', 20 );
function dotspice_below_single_product_summary() {
echo '<div class="alertCartForm d-none" role="alert">Uzupełnij wszystkie wymagane pola w konfiguracji produktu!</div>';
}
/**
* Display custom badge
*/
add_action( 'woocommerce_before_shop_loop_item_title', 'dotspice_available_badge_shop_page', 3 );
function dotspice_available_badge_shop_page() {
if ( $badge = get_field( 'badge' ) ) {
echo '<span class="available onsale">' . esc_html( $badge ) . '</span>';
}
}
// Wyłącz Heartbeat
//add_action('init', 'stop_heartbeat', 1);
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}