$author_slug, 'per_page' => 100, // Fetch all plugins 'fields' => array( 'icons' => true, 'banners' => true, 'active_installs' => true, 'short_description' => true, 'rating' => true, 'num_ratings' => true, 'last_updated' => true, ), ); $response = plugins_api( 'query_plugins', $api_args ); if ( ! is_wp_error( $response ) && isset( $response->plugins ) ) { $plugins = $response->plugins; // Cache for 12 hours set_transient( $transient_key, $plugins, 12 * HOUR_IN_SECONDS ); } else { $plugins = array(); } } // Filter and Categorize $filtered_plugins = array(); // List of keywords or slugs for "New Releases" $new_keywords = array( 'Ultimate Portfolio', 'Right Click Ban', 'Dead Link Checker', 'Universal Unit Converter', 'Job Board', 'Schema Markup Generator', 'Lead Generation Form' ); // Fallback Slugs $new_slugs = array( 'ultimate-portfolio', 'right-click-ban', 'dead-link-checker', 'universal-unit-converter', 'job-board', 'schema-markup-generator', 'lead-generation-form', 'job-board-manager' ); $technical_slugs = array( 'wp-life-companion', 'shortcode-generator', 'dead-link-checker', 'schema-markup-generator', 'right-click-ban' ); // Technical Keywords $technical_keywords = array( 'Right Click Ban', 'Dead Link Checker', 'Schema Markup Generator', 'Shortcode Generator', 'Login Page Customizer' ); // Social Media Keywords $social_keywords = array( 'social', 'share', 'facebook', 'instagram', 'twitter', 'tiktok', 'feed', 'icon', 'whatsapp', 'messenger', 'flickr', 'youtube', 'vimeo' ); // Marketing & Growth Keywords $marketing_keywords = array( 'Event Monster', 'Testimonial', 'Pricing Table', 'Team Member', 'Coming Soon', 'Maintenance', 'Contact Form', 'Lead Generation' ); // Social Media Manual Names $social_manual_names = array( 'Animated Live Wall', 'Album Gallery For Flickr', 'Album Photostream Flickr Gallery', 'Video Gallery YouTube Vimeo' ); foreach ( $plugins as $plugin ) { $plugin = (array) $plugin; $slug = isset($plugin['slug']) ? $plugin['slug'] : ''; $name = isset($plugin['name']) ? $plugin['name'] : ''; // 1. Remove Companion plugins if ( stripos( $slug, 'companion' ) !== false ) { continue; } // 2. Assign Categories $categories = array( 'all' ); // Popular if > 5,000 installs if ( isset($plugin['active_installs']) && (int) $plugin['active_installs'] >= 5000 ) { $categories[] = 'popular'; } // New if slug matches or name contains keywords $is_new = false; if ( in_array( $slug, $new_slugs ) ) { $is_new = true; } else { foreach ( $new_keywords as $keyword ) { if ( stripos( $name, $keyword ) !== false ) { $is_new = true; break; } } } if ( $is_new ) { $categories[] = 'new'; } // Technical check $is_technical = false; if ( in_array( $slug, $technical_slugs ) ) { $is_technical = true; } else { foreach ( $technical_keywords as $t_keyword ) { if ( stripos( $name, $t_keyword ) !== false ) { $is_technical = true; break; } } } if ( $is_technical ) { $categories[] = 'technical'; } // Marketing & Growth check foreach ( $marketing_keywords as $m_keyword ) { if ( stripos( $name, $m_keyword ) !== false ) { $categories[] = 'marketing'; break; } } // Social Media check (Exclude testimonials as requested) if ( stripos( $name, 'testimonial' ) === false && stripos( $slug, 'testimonial' ) === false ) { $is_social = false; // Check manual names foreach ( $social_manual_names as $s_name ) { if ( stripos( $name, $s_name ) !== false ) { $is_social = true; break; } } // Check keywords if not already matched if ( ! $is_social ) { foreach ( $social_keywords as $s_keyword ) { if ( stripos( $name, $s_keyword ) !== false || stripos( $slug, $s_keyword ) !== false ) { $is_social = true; break; } } } if ( $is_social ) { $categories[] = 'social'; } } $plugin['ig_categories'] = $categories; $filtered_plugins[] = (object) $plugin; } // Sort by active installs descending usort( $filtered_plugins, function ( $a, $b ) { $a = (array) $a; $b = (array) $b; $a_installs = isset($a['active_installs']) ? (int) $a['active_installs'] : 0; $b_installs = isset($b['active_installs']) ? (int) $b['active_installs'] : 0; return $b_installs - $a_installs; } ); ?>