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/page-intercept.php

    r13301 r14190  
    22
    33namespace WordPressdotorg\Theme_Preview\Style_Variations\Page_Intercept;
     4
     5use function WordPressdotorg\Theme_Preview\Style_Variations\get_style_variations;
    46
    57/**
     
    3032     * Retrieve all variations and match to make sure we have one with the same title.
    3133     */
    32     $variations = \WP_Theme_JSON_Resolver::get_style_variations();
     34    $variations = get_style_variations();
    3335    if ( empty( $variations ) ) {
    3436        return false;
     
    99101 * We need to call gutenberg's filter `theme_json_user` to make sure the styles are applied to the page.
    100102 * This use to work for both the page and card but a core change stopped that.
    101  * 
     103 *
    102104 * See: https://core.trac.wordpress.org/ticket/56812
    103  * 
     105 *
    104106 * We now need to also call the core filter `wp_theme_json_data_user` to get the card preview to work.
    105107 * Hopefully this code can be remove when we have a better component to use.
    106  * 
     108 *
    107109 * Ref: https://github.com/WordPress/gutenberg/issues/44886
    108110
Note: See TracChangeset for help on using the changeset viewer.