diff --git a/wp-content/themes/cosmopet/functions.php b/wp-content/themes/cosmopet/functions.php
index ed584db..0832e2f 100644
--- a/wp-content/themes/cosmopet/functions.php
+++ b/wp-content/themes/cosmopet/functions.php
@@ -14,6 +14,7 @@ require_once __DIR__ . '/temp-functions/ajax-logic.php';
require_once __DIR__ . '/temp-functions/shortcodes-logic.php';
require_once __DIR__ . '/temp-functions/blog-logic.php';
require_once __DIR__ . '/temp-functions/filters-logic.php';
+require_once __DIR__ . '/temp-functions/custom-admin-panel-logic.php';
// include_module('forms');
// include_module('shop');
diff --git a/wp-content/themes/cosmopet/global-functions/core-functions.php b/wp-content/themes/cosmopet/global-functions/core-functions.php
index def1230..bf7e684 100644
--- a/wp-content/themes/cosmopet/global-functions/core-functions.php
+++ b/wp-content/themes/cosmopet/global-functions/core-functions.php
@@ -3,14 +3,14 @@
add_action('template_redirect', 'redirect_non_logged_in_users');
function redirect_non_logged_in_users() {
-// URL личного кабинета (замените 'your-account-page-slug' на ваш slug)
-$account_page_slug = 'my-account-3';
-$account_page_slug__2 = 'my-account';
-// Проверяем, находится ли пользователь на странице личного кабинета
-if (is_page($account_page_slug) && !is_user_logged_in() || is_page($account_page_slug__2) && !is_user_logged_in() ) {
- wp_redirect(home_url()); // Перенаправляем на главную страницу
- exit;
-}
+ // URL личного кабинета (замените 'your-account-page-slug' на ваш slug)
+ $account_page_slug = 'my-account-3';
+ $account_page_slug__2 = 'my-account';
+ // Проверяем, находится ли пользователь на странице личного кабинета
+ if (is_page($account_page_slug) && !is_user_logged_in() || is_page($account_page_slug__2) && !is_user_logged_in() ) {
+ wp_redirect(home_url()); // Перенаправляем на главную страницу
+ exit;
+ }
}
add_action('init', 'register_pets');
@@ -135,40 +135,32 @@ case ('high'):
-
-
-
-
-
-
-
-
-
-
-
+ :
+
+
+ endif; ?>
+
+
+
+ endif; ?>
+
+
+
+
+
ID, '_composition', true);
+ echo '';
+ woocommerce_wp_textarea_input([
+ 'id' => '_composition',
+ 'label' => 'Состав',
+ 'desc_tip' => true,
+ 'description' => 'Введите состав товара',
+ 'value' => $composition
+ ]);
+ echo '
';
+});
+
+/* Вывод пользовательских табов */
+// add_action('woocommerce_product_data_panels', function () {
+// global $post;
+// $feeding = get_post_meta($post->ID, '_feeding_recommendations', true);
+// echo '';
+// woocommerce_wp_textarea_input([
+// 'id' => '_feeding_recommendations',
+// 'label' => 'Рекомендации по кормлению',
+// 'desc_tip' => true,
+// 'description' => 'Введите рекомендации по кормлению',
+// 'value' => $feeding
+// ]);
+// echo '
';
+// });
+
+
+// add_action('woocommerce_product_data_panels', function () {
+// global $post;
+// $important = get_post_meta($post->ID, '_important', true);
+// echo '';
+// woocommerce_wp_textarea_input([
+// 'id' => '_important',
+// 'label' => 'Важно',
+// 'desc_tip' => true,
+// 'description' => 'Введите важную информацию',
+// 'value' => $important
+// ]);
+// echo '
';
+// });
+
+// woocommerce_product_options_inventory_product_data ]
+
+add_filter('woocommerce_product_data_tabs', function ($tabs) {
+ $tabs['composition_tab'] = array(
+ 'label' => 'Состав',
+ 'target' => 'composition_product_data',
+ 'class' => array('composition_tab'),
+ 'priority' => 60,
+ );
+ // shipping_product_data
+ // shipping_options
+ // shipping_tab
+
+
+ // $tabs['feeding_tab'] = array(
+ // 'label' => 'Рекомендации по кормлению',
+ // 'target' => 'feeding_product_data',
+ // 'class' => array('feeding_tab'),
+ // 'priority' => 61,
+ // );
+ // $tabs['important_tab'] = array(
+ // 'label' => 'Важно',
+ // 'target' => 'important_product_data',
+ // 'class' => array('important_tab'),
+ // 'priority' => 62,
+ // );
+ return $tabs;
+});
+
+/* сохраненение кастомных полей */
+add_action('woocommerce_process_product_meta', function ($post_id) {
+ if (isset($_POST['_composition'])) {
+ update_post_meta($post_id, '_composition', sanitize_textarea_field($_POST['_composition']));
+ }
+ // if (isset($_POST['_feeding_recommendations'])) {
+ // update_post_meta($post_id, '_feeding_recommendations', sanitize_textarea_field($_POST['_feeding_recommendations']));
+ // }
+ // if (isset($_POST['_important'])) {
+ // update_post_meta($post_id, '_important', sanitize_textarea_field($_POST['_important']));
+ // }
+});
+
+/**
+ * End: Добавление табов и полей в стандартной форме редактирования товара Woocommerce
+ */
\ No newline at end of file
diff --git a/wp-content/themes/cosmopet/temp-functions/woocommerce-logic.php b/wp-content/themes/cosmopet/temp-functions/woocommerce-logic.php
index 5d991d1..7392fde 100644
--- a/wp-content/themes/cosmopet/temp-functions/woocommerce-logic.php
+++ b/wp-content/themes/cosmopet/temp-functions/woocommerce-logic.php
@@ -148,84 +148,7 @@ function get_collection_siblings ($term) {
add_filter( 'woocommerce_price_trim_zeros', '__return_true' );
-add_filter('woocommerce_product_data_tabs', function($tabs) {
- $tabs['composition_tab'] = array(
- 'label' => 'Состав',
- 'target' => 'composition_product_data',
- 'class' => array('composition_tab'),
- 'priority' => 60,
- );
- $tabs['feeding_tab'] = array(
- 'label' => 'Рекомендации по кормлению',
- 'target' => 'feeding_product_data',
- 'class' => array('feeding_tab'),
- 'priority' => 61,
- );
- $tabs['important_tab'] = array(
- 'label' => 'Важно',
- 'target' => 'important_product_data',
- 'class' => array('important_tab'),
- 'priority' => 62,
- );
- return $tabs;
-});
-
-
-add_action('woocommerce_product_data_panels', function() {
- global $post;
- $composition = get_post_meta($post->ID, '_composition', true);
- echo '';
- woocommerce_wp_textarea_input([
- 'id' => '_composition',
- 'label' => 'Состав',
- 'desc_tip' => true,
- 'description' => 'Введите состав товара',
- 'value' => $composition
- ]);
- echo '
';
-});
-
-add_action('woocommerce_product_data_panels', function() {
- global $post;
- $feeding = get_post_meta($post->ID, '_feeding_recommendations', true);
- echo '';
- woocommerce_wp_textarea_input([
- 'id' => '_feeding_recommendations',
- 'label' => 'Рекомендации по кормлению',
- 'desc_tip' => true,
- 'description' => 'Введите рекомендации по кормлению',
- 'value' => $feeding
- ]);
- echo '
';
-});
-
-
-add_action('woocommerce_product_data_panels', function() {
- global $post;
- $important = get_post_meta($post->ID, '_important', true);
- echo '';
- woocommerce_wp_textarea_input([
- 'id' => '_important',
- 'label' => 'Важно',
- 'desc_tip' => true,
- 'description' => 'Введите важную информацию',
- 'value' => $important
- ]);
- echo '
';
-});
-
-add_action('woocommerce_process_product_meta', function($post_id) {
- if (isset($_POST['_composition'])) {
- update_post_meta($post_id, '_composition', sanitize_textarea_field($_POST['_composition']));
- }
- if (isset($_POST['_feeding_recommendations'])) {
- update_post_meta($post_id, '_feeding_recommendations', sanitize_textarea_field($_POST['_feeding_recommendations']));
- }
- if (isset($_POST['_important'])) {
- update_post_meta($post_id, '_important', sanitize_textarea_field($_POST['_important']));
- }
-});
// Добавление поля для выбора рекомендуемых товаров
function register_recommended_products_acf_field() {
if (function_exists('acf_add_local_field_group')) {