From e1542909fa1b8662311b79069c749698f53e4c9f Mon Sep 17 00:00:00 2001 From: maksim Date: Wed, 18 Jun 2025 06:41:57 +0300 Subject: [PATCH] =?UTF-8?q?Task=206591=20|=20fix:=20=D0=9C=D0=B0=D0=BA?= =?UTF-8?q?=D1=81=20=D0=BF=D0=BE=D1=84=D0=B8=D0=BA=D1=81=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4=D0=B0=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82?= =?UTF-8?q?=D0=BE=D0=B2,=20=D1=87=D1=82=D0=BE=D0=B1=20=D0=BE=D0=BD=D0=B8?= =?UTF-8?q?=20=D0=B2=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D0=BE=D0=BC=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=B5=20=D0=BD=D0=B5=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B2=D0=BE=D0=B4=D0=B8=D0=BB=D0=B8=D1=81=D1=8C,=20?= =?UTF-8?q?=D1=82=D0=B0=D0=BA=20=D0=B6=D0=B5=20=D0=BF=D0=BE=D1=87=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=20=D0=BB=D0=B8=D1=88=D0=BD=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global-functions/multisite-functions.php | 234 ++++++++---------- .../cosmopet/temp-functions/blog-logic.php | 44 ++-- .../cosmopet/temp-functions/filters-logic.php | 20 +- .../themes/cosmopet/templates/layout.twig | 4 +- 4 files changed, 143 insertions(+), 159 deletions(-) diff --git a/wp-content/themes/cosmopet/global-functions/multisite-functions.php b/wp-content/themes/cosmopet/global-functions/multisite-functions.php index 0e8472c..6b6d4a1 100644 --- a/wp-content/themes/cosmopet/global-functions/multisite-functions.php +++ b/wp-content/themes/cosmopet/global-functions/multisite-functions.php @@ -82,30 +82,6 @@ function custom_canonical_url() { } } -add_action('wp_head', 'add_facebook_pixel'); -function add_facebook_pixel() { - ?> - - - - - - - get_status() !== 'processing' && $order->get_status() !== 'completed')) return; - - $items = []; - foreach ($order->get_items() as $item) { - $product = $item->get_product(); - $items[] = [ - 'item_id' => $product->get_id(), - 'item_name' => $product->get_name(), - 'price' => $product->get_price(), - 'quantity' => $item->get_quantity() - ]; + + - - get_status() !== 'processing' && $order->get_status() !== 'completed')) return; + + $items = []; + foreach ($order->get_items() as $item) { + $product = $item->get_product(); + $items[] = [ + 'item_id' => $product->get_id(), + 'item_name' => $product->get_name(), + 'price' => $product->get_price(), + 'quantity' => $item->get_quantity() + ]; + } + ?> + + ', - 'value': - } + // 3. Событие AddPaymentInfo + if (is_checkout() && !is_wc_endpoint_url('order-received')) { + $currency = get_woocommerce_currency(); + $cart_total = WC()->cart ? WC()->cart->get_total('edit') : 0; + ?> + - + prefix . 'cosmopet_likes'; -$user_id = get_current_user_id(); -$result = $wpdb->get_var($wpdb->prepare( - "SELECT COUNT(*) FROM $table_name WHERE post_id = %d AND user_id = %d", - $post_id, $user_id -)); -return $result > 0; + if (!is_user_logged_in()) { + return false; + } + global $wpdb; + $table_name = $wpdb->prefix . 'cosmopet_likes'; + $user_id = get_current_user_id(); + $result = $wpdb->get_var($wpdb->prepare( + "SELECT COUNT(*) FROM $table_name WHERE post_id = %d AND user_id = %d", + $post_id, $user_id + )); + return $result > 0; } function is_user_liked_comment($comment_id) { -if (!is_user_logged_in()) { - return false; -} -global $wpdb; -$table_name = $wpdb->prefix . 'cosmopet_likes'; -$user_id = get_current_user_id(); -$result = $wpdb->get_var($wpdb->prepare( - "SELECT COUNT(*) FROM $table_name WHERE comment_id = %d AND user_id = %d", - $comment_id, $user_id -)); -return $result > 0; + if (!is_user_logged_in()) { + return false; + } + global $wpdb; + $table_name = $wpdb->prefix . 'cosmopet_likes'; + $user_id = get_current_user_id(); + $result = $wpdb->get_var($wpdb->prepare( + "SELECT COUNT(*) FROM $table_name WHERE comment_id = %d AND user_id = %d", + $comment_id, $user_id + )); + return $result > 0; } diff --git a/wp-content/themes/cosmopet/temp-functions/filters-logic.php b/wp-content/themes/cosmopet/temp-functions/filters-logic.php index 87c7b20..4abab5f 100644 --- a/wp-content/themes/cosmopet/temp-functions/filters-logic.php +++ b/wp-content/themes/cosmopet/temp-functions/filters-logic.php @@ -9,14 +9,14 @@ register_sidebar( array( 'after_title' => '', ) ); -// Для кнопки "Применить фильтр" -add_filter('wbw_filter_submit_button_text', 'change_wbw_filter_button_text'); -function change_wbw_filter_button_text($text) { - return 'Ваш текст'; // Например, "Фильтровать" или "Поиск" -} +// // Для кнопки "Применить фильтр" +// add_filter('wbw_filter_submit_button_text', 'change_wbw_filter_button_text'); +// function change_wbw_filter_button_text($text) { +// return 'Ваш текст'; // Например, "Фильтровать" или "Поиск" +// } -// Для кнопки сброса (если есть) -add_filter('wbw_filter_reset_button_text', 'change_wbw_reset_button_text'); -function change_wbw_reset_button_text($text) { - return 'Сбросить'; -} \ No newline at end of file +// // Для кнопки сброса (если есть) +// add_filter('wbw_filter_reset_button_text', 'change_wbw_reset_button_text'); +// function change_wbw_reset_button_text($text) { +// return 'Сбросить'; +// } \ No newline at end of file diff --git a/wp-content/themes/cosmopet/templates/layout.twig b/wp-content/themes/cosmopet/templates/layout.twig index 24a3a07..2d83f3b 100644 --- a/wp-content/themes/cosmopet/templates/layout.twig +++ b/wp-content/themes/cosmopet/templates/layout.twig @@ -7,7 +7,9 @@ - {{ header_scripts }} + {% if site_mode == 'production' %} + {{ header_scripts }} + {% endif %}