Making WordPress.org


Ignore:
Timestamp:
11/21/2024 07:16:33 PM (3 months ago)
Author:
ryelle
Message:

Theme Previews: Filter out duplicate style variations

If there are duplicate style variations, it's likely that one is a subset (color palette or type set) and one is combined. Find the one with more settings and use that.

Merges WordPress/wordpress.org#425, fixes WordPress/wporg-theme-directory#158.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wp-themes.com/public_html/wp-content/plugins/style-variations/inc/styles-endpoint.php

    r13301 r14190  
    33namespace WordPressdotorg\Theme_Preview\Style_Variations\API_Endpoint;
    44
     5use function WordPressdotorg\Theme_Preview\Style_Variations\get_style_variations;
     6
    57function endpoint_handler() {
    6     $variations = \WP_Theme_JSON_Resolver::get_style_variations();
     8    $variations = get_style_variations();
    79    $theme_slug = get_option( 'stylesheet' );
    810    $styles     = array();
     
    2628        foreach ( $variations as $variation ) {
    2729            $title = strtolower( $variation['title'] );
    28             $link  = add_query_arg( 'style_variation', urlencode( $title ), $base );;
     30            $link  = add_query_arg( 'style_variation', urlencode( $title ), $base );
    2931
    3032            $styles[] = array(
Note: See TracChangeset for help on using the changeset viewer.