post_type === 'product' || $post->post_type === 'post') { // Add your custom buttons $custom_buttons = array( ''.esc_html__('AI Title Generator', 'ai-title-generator').'', ); // Find the position of 'clone' in the $actions array $clone_position = array_search('clone', array_keys($actions)); // Insert the custom buttons after 'clone' $i = 1; foreach ($custom_buttons as $custom_button) { $actions = array_slice($actions, 0, $clone_position + 2 + $i, true) + array('custom_button_'.$i => $custom_button) + array_slice($actions, $clone_position + 2 + $i, null, true); $i++; } } return $actions; } } // Popup Box for admin if( !function_exists('aitgen_title_generator_box_admin')){ function aitgen_title_generator_box_admin() { $current_screen = get_current_screen(); // Check if the current screen is related to the 'product' post type if ($current_screen && $current_screen->post_type === 'product' || $current_screen && $current_screen->post_type === 'post' || $current_screen ) { aitgen_titleRegenerate_modal(); aitgen_shortDescriptionRegenerate_modal(); } } } // Title Regenerator Modal if( !function_exists('aitgen_titleRegenerate_modal')){ function aitgen_titleRegenerate_modal(){ ?>