ai_content_wizard_get_setting('ai_content_wizard_format', 'post'), 'textLength' => ai_content_wizard_get_setting('ai_content_wizard_text_length', '500'), 'writingStyle' => ai_content_wizard_get_setting('ai_content_wizard_writing_style', 'formal'), 'targetAudience' => ai_content_wizard_get_setting('ai_content_wizard_target_audience', 'general'), 'targetRegion' => ai_content_wizard_get_setting('ai_content_wizard_target_region', ''), 'enableImageGeneration'=> ai_content_wizard_get_setting('ai_content_wizard_enable_image_generation', 0), 'siteType' => ai_content_wizard_get_setting('ai_content_wizard_site_type', 'store'), // Так как поля Custom Theme и Additional Requests убраны, их не передаём. 'postStatus' => ai_content_wizard_get_setting('ai_content_wizard_post_status', 'publish'), 'enableAdditionalImages' => 0, // Доп. изображения доступны только в PRO 'numberOfAdditionalImages' => 0, 'textModel' => ai_content_wizard_get_setting('ai_content_wizard_text_model', 'gpt-4o-mini'), ]; wp_localize_script('ai-content-wizard-single-post-script', 'initialSettings', $initial_settings); wp_enqueue_style('ai-content-wizard-single-post-style', AI_CONTENT_WIZARD_URL . 'css/single-post-styles.css', array(), AI_CONTENT_WIZARD_VERSION); } add_action('admin_enqueue_scripts', 'enqueue_single_post_script'); function ai_content_wizard_create_post_page() { // Получение списка категорий $categories = get_categories(array('hide_empty' => false)); // Ограничиваем языки для lite-версии $languages = [ 'en_US' => 'English (United States)', 'ru_RU' => 'Русский', 'uk' => 'Українська' ]; // Текущий язык сайта $current_language = get_locale(); $default_language = array_key_exists($current_language, $languages) ? $current_language : 'en_US'; // Получение текущего выбранного статуса поста $selected_post_status = ai_content_wizard_get_setting('ai_content_wizard_post_status', 'publish'); if (isset($_POST['ai_content_wizard_generate_post'])) { error_log('[create-post-page.php] Начало обработки POST-запроса: ' . print_r($_POST, true)); // Получение данных формы (категория, тема и т.д.) $category_id = isset($_POST['category']) ? intval($_POST['category']) : 0; $post_topic = isset($_POST['post_topic']) ? sanitize_text_field($_POST['post_topic']) : ''; // Поле "Related Articles" удалено $selected_language = isset($_POST['language_select']) ? sanitize_text_field($_POST['language_select']) : $default_language; $single_post_additional_request = isset($_POST['single_post_additional_request']) ? sanitize_textarea_field($_POST['single_post_additional_request']) : ''; // Поле "Author" удалено, автор всегда текущий пользователь $author = get_current_user_id(); // Статус поста и дополнительное пожелание блокируются, поэтому используем сохранённое значение $selected_post_status = ai_content_wizard_get_setting('ai_content_wizard_post_status', 'publish'); // Режим expert/longread недоступен – всегда используется обычный режим $post_mode = 'normal'; // Вызываем функцию генерации обычного поста $post_id = ai_content_wizard_generate_single_post( $category_id, $post_topic, '', // Related Articles не передаём $selected_language, $selected_post_status, $single_post_additional_request, $author ); // Остальной код обработки (редирект, вывод сообщений и т.д.) остаётся без изменений } // Массивы данных по текстовым моделям $text_model_names = [ 'gpt-3.5-turbo' => 'GPT-3.5-turbo', 'gpt-3.5-turbo-16k' => 'GPT-3.5-turbo 16k', 'gpt-4' => 'GPT-4', 'gpt-4-turbo' => 'GPT-4 Turbo' ]; $text_model = ai_content_wizard_get_setting('ai_content_wizard_text_model', 'gpt-4o-mini'); $text_model_display_name = array_key_exists($text_model, $text_model_names) ? $text_model_names[$text_model] : 'Unknown Model'; // Глобальные настройки для отображения $current_settings = [ 'Format' => ai_content_wizard_get_setting('ai_content_wizard_format', 'post'), 'Text Length' => ai_content_wizard_get_setting('ai_content_wizard_text_length', '500'), 'Site Type' => ai_content_wizard_get_setting('ai_content_wizard_site_type', 'store'), 'Writing Style' => ai_content_wizard_get_setting('ai_content_wizard_writing_style', 'formal'), 'Target Audience'=> ai_content_wizard_get_setting('ai_content_wizard_target_audience', 'general'), 'Region' => ai_content_wizard_get_setting('ai_content_wizard_target_region', ''), 'Post Status' => ai_content_wizard_get_setting('ai_content_wizard_post_status', 'publish'), 'Additional Images' => '0 (PRO)' ]; echo '

' . __('AI Content Wizard - Create Post', 'ai-content-wizard') . '

'; echo '
'; echo '

' . __('On this page, you can generate articles for any category and on any topic of your choice. Use the settings to tailor the content to your website’s theme and audience.', 'ai-content-wizard') . '

'; echo '

' . __('Select the category, define the post topic, and adjust other settings. Note that additional options (like longread mode, author selection, and related articles) are available only in the Pro version.', 'ai-content-wizard') . '

'; echo '
'; ?>
PRO
' . esc_html__('Open diagnostics', 'ai-content-wizard') . '' ); ?>

( ) -

Estimated Cost $0.725

$setting_value): ?>
: PRO Edit

var globalSettings = ' . json_encode($current_settings) . '; '; echo ''; } add_action('wp_ajax_get_category_settings', 'ai_content_wizard_get_category_settings'); function ai_content_wizard_get_category_settings() { $category_id = 'category-' . intval($_POST['category_id']); $settings = [ 'format' => ai_content_wizard_get_category_setting($category_id, 'format', ai_content_wizard_get_setting('ai_content_wizard_format')), 'textLength' => ai_content_wizard_get_category_setting($category_id, 'text_length', ai_content_wizard_get_setting('ai_content_wizard_text_length')), 'writingStyle' => ai_content_wizard_get_category_setting($category_id, 'writing_style', ai_content_wizard_get_setting('ai_content_wizard_writing_style')), 'targetAudience' => ai_content_wizard_get_category_setting($category_id, 'target_audience', ai_content_wizard_get_setting('ai_content_wizard_target_audience')), 'targetRegion' => ai_content_wizard_get_category_setting($category_id, 'target_region', ai_content_wizard_get_setting('ai_content_wizard_target_region')), 'additionalRequests' => ai_content_wizard_get_category_setting($category_id, 'additional_requests', ai_content_wizard_get_setting('ai_content_wizard_additional_requests')), 'enableImageGeneration' => ai_content_wizard_get_category_setting($category_id, 'enable_image_generation', ai_content_wizard_get_setting('ai_content_wizard_enable_image_generation')), 'siteType' => ai_content_wizard_get_category_setting($category_id, 'site_type', ai_content_wizard_get_setting('ai_content_wizard_site_type')), 'customTheme' => ai_content_wizard_get_category_setting($category_id, 'custom_theme', ai_content_wizard_get_setting('ai_content_wizard_custom_theme')), 'postStatus' => ai_content_wizard_get_category_setting($category_id, 'post_status', ai_content_wizard_get_setting('ai_content_wizard_post_status')), 'enableAdditionalImages' => ai_content_wizard_get_category_setting($category_id, 'enable_additional_images', ai_content_wizard_get_setting('ai_content_wizard_enable_additional_images')), 'numberOfAdditionalImages' => ai_content_wizard_get_category_setting($category_id, 'additional_images_count', ai_content_wizard_get_setting('ai_content_wizard_additional_images_count')), ]; wp_send_json_success($settings); }