array( 'name' => __('Magical Addons For Elementor', 'aak'), 'slug' => 'magical-addons-for-elementor', 'file' => 'magical-addons-for-elementor/magical-addons-for-elementor.php', 'description' => __('Magical Addons for Elementor is a collection of premium quality addons or widgets for Elementor page builder.', 'aak'), 'category' => 'Page Builder', 'required' => false, 'featured' => true, 'is_local' => false, ), 'magical-posts-display' => array( 'name' => __('Magical Posts Display', 'aak'), 'slug' => 'magical-posts-display', 'file' => 'magical-posts-display/magical-posts-display.php', 'description' => __('Display posts in beautiful layouts with various customization options. Perfect for blogs, news sites, and portfolios.', 'aak'), 'category' => 'Content Display', 'required' => false, 'featured' => true, 'is_local' => false, ), 'magical-blocks' => array( 'name' => __('Magical Blocks', 'aak'), 'slug' => 'magical-blocks', 'file' => 'magical-blocks/magical-blocks.php', 'description' => __('A collection of customizable blocks for the WordPress block editor.', 'aak'), 'category' => 'Content Display', 'required' => false, 'featured' => true, 'is_local' => false, ), ); return array_merge($plugins, $theme_plugins); } add_filter('magical_plugin_activation_recommended_plugins', 'aak_recommended_plugins'); /** * STEP 3: Advanced Usage Examples * Demonstrate different ways to use the available filters */ /** * Example 1: Add plugins conditionally based on WooCommerce availability */ function aak_conditional_plugins($plugins) { // Ensure is_plugin_active() function is available if (!function_exists('is_plugin_active')) { include_once(ABSPATH . 'wp-admin/includes/plugin.php'); } // Only add WooCommerce plugins if WooCommerce is active or installed if (class_exists('WooCommerce') || is_plugin_active('woocommerce/woocommerce.php')) { $ecommerce_plugins = array( 'magical-products-display' => array( 'name' => __('Magical Products Display', 'aak'), 'slug' => 'magical-products-display', 'file' => 'magical-products-display/magical-products-display.php', 'description' => __('Display WooCommerce products in beautiful layouts with various customization options. Perfect for online stores and product showcases.', 'aak'), 'category' => 'eCommerce', 'required' => false, 'featured' => true, 'is_local' => false, ), ); $plugins = array_merge($plugins, $ecommerce_plugins); } return $plugins; } add_filter('magical_plugin_activation_add_recommended_plugins', 'aak_conditional_plugins'); /** * USAGE INSTRUCTIONS: * * 1. Copy this example file to your theme directory * 2. Include the relevant parts in your functions.php * 3. Customize the plugin array with your own plugins * 4. Test the functionality in your WordPress admin * 5. Adjust styling and behavior as needed * * NOTES: * - Replace 'aak' with your actual theme textdomain * - Ensure all plugin slugs and file paths are correct * - Test local plugin installation with actual ZIP files * - Always check user capabilities before showing admin interfaces * - Use proper WordPress coding standards and security practices */