/', '> $value) { $is_selected = is_array($selected) ? in_array($key, $selected) : $key === $selected; ?> post_type ) { // Register a dummy admin style if needed wp_register_style( 'ws4agpt-post-admin-post-style', false, [], WS4AGPT_ARTICLES_VERSION ); wp_enqueue_style( 'ws4agpt-post-admin-post-style' ); $ws4agpt_custom_css = ' #poststuff .aioseo-taxonomy-upsell { display: none !important; } '; wp_add_inline_style( 'ws4agpt-post-admin-post-style', $ws4agpt_custom_css ); } } add_action('admin_head', 'ws4agpt_hide_aioseo_section_for_gpt_post'); /** * Enqueue admin styles for WS4AGPT plugin. * * @since 1.0.0 * * @param string $hook_suffix Current admin page hook. * @return void */ function ws4agpt_plugin_enqueue_styles($hook) { $screen = get_current_screen(); if ( $screen && 'ws4agpt_gpt_post' === $screen->post_type ) { $ws4agpt_acss_path = WS4AGPT_ARTICLES_PLUGIN_DIR . 'assets/css/admin.css'; $ws4agpt_aver = defined('WS4AGPT_ARTICLES_VERSION') ? WS4AGPT_ARTICLES_VERSION : ( file_exists($ws4agpt_acss_path) ? filemtime($ws4agpt_acss_path) : false ); wp_enqueue_style( 'ws4agpt-plugin-styles', WS4AGPT_ARTICLES_PLUGIN_URL . 'assets/css/admin.css', array(), $ws4agpt_aver ); } else { wp_register_style( 'ws4agpt-custom-post-admin-post-style', false, [], WS4AGPT_ARTICLES_VERSION ); wp_enqueue_style( 'ws4agpt-custom-post-admin-post-style' ); $ws4agpt_custompage_css = ' .ws4agpt_free_msgdiv { display: flex; align-items: center; gap: 20px; background-color: #2271b145; border-left-color: #e74c3c; padding: 15px; } .ws4agpt_free_msgdiv a { display: inline-block; background-color: #e74c3c; color: #fff; padding: 8px 16px; border-radius: 4px; text-decoration: none; font-size: 1em; } #ws4agpt_overlay { display: none; } '; wp_add_inline_style( 'ws4agpt-custom-post-admin-post-style', $ws4agpt_custompage_css ); } } add_action('admin_enqueue_scripts', 'ws4agpt_plugin_enqueue_styles'); // Helper function to generate nonce URL for post type pages function ws4agpt_get_gpt_post_type_url($post_type) { $nonce = wp_create_nonce('gpt_post_type_action'); return add_query_arg( array( 'post_type' => $post_type, '_wpnonce' => $nonce ), admin_url('edit.php') ); } /** * Enqueue frontend styles for WS4AGPT plugin. * * @since 1.0.0 * * @return void */ function ws4agpt_enqueue_frontend_styles() { $ws4agpt_fcss_path = WS4AGPT_ARTICLES_PLUGIN_DIR . 'assets/css/admin.css'; $ws4agpt_fver = defined('WS4AGPT_ARTICLES_VERSION') ? WS4AGPT_ARTICLES_VERSION : ( file_exists($ws4agpt_fcss_path) ? filemtime($ws4agpt_fcss_path) : false ); wp_enqueue_style( 'ws4agpt-autoseo-frontend-style', WS4AGPT_ARTICLES_PLUGIN_URL . 'assets/css/fstyle.css', array(), $ws4agpt_fver ); } add_action('wp_enqueue_scripts', 'ws4agpt_enqueue_frontend_styles'); /** * Remove "Add New" submenu from GPT Posts. * * @since 1.0.0 * * @return void */ add_action('admin_menu', function() { remove_submenu_page( 'edit.php?post_type=ws4agpt_gpt_post', // parent menu 'post-new.php?post_type=ws4agpt_gpt_post' // child to remove ); }, 20); /** * Remove description field from Titles taxonomy edit screen. * * @since 1.0.0 * * @return void */ function ws4agpt_remove_titles_description_field() { $screen = get_current_screen(); if ( $screen && 'edit-titles' === $screen->id ) { wp_register_script('ws4agpt-admin-js', '', [], WS4AGPT_ARTICLES_VERSION, true); wp_enqueue_script('ws4agpt-admin-js'); wp_add_inline_script( 'ws4agpt-admin-js', "jQuery(document).ready(function($){ $('#tag-description').parent().remove(); });" ); } } add_action( 'admin_enqueue_scripts', 'ws4agpt_remove_titles_description_field' );