Making WordPress.org

Changeset 13396


Ignore:
Timestamp:
03/28/2024 01:17:20 AM (10 months ago)
Author:
tellyworth
Message:

Plugin Directory: add browse view for preview-enabled plugins

Note that the page is unlinked and noindexed, since it is mainly for use by the team and might be removed in future.

Fixes #7534

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r13354 r13396  
    547547
    548548        // Add the browse/* views.
    549         add_rewrite_tag( '%browse%', '(featured|popular|beta|blocks|block|new|favorites|adopt-me|updated)' );
     549        add_rewrite_tag( '%browse%', '(featured|popular|beta|blocks|block|new|favorites|adopt-me|updated|preview)' );
    550550        add_permastruct( 'browse', 'browse/%browse%' );
    551551
     
    796796        if (
    797797            ! empty ( $wp_query->query['browse'] ) &&
    798             ! in_array( $wp_query->query['browse'], array( 'featured', 'popular', 'beta', 'blocks', 'block', 'new', 'favorites', 'adopt-me', 'updated' ) )
     798            ! in_array( $wp_query->query['browse'], array( 'featured', 'popular', 'beta', 'blocks', 'block', 'new', 'favorites', 'adopt-me', 'updated', 'preview' ) )
    799799        ) {
    800800             $wp_query->query['browse']      = 'featured';
     
    813813                    'value'   => gmdate( 'Y-m-d H:i:s', time() - YEAR_IN_SECONDS ),
    814814                    'compare' => '>',
     815                ];
     816                $wp_query->set( 'meta_query', $meta_query );
     817
     818                break;
     819
     820            case 'preview':
     821                $wp_query->query_vars['orderby'] ??= 'last_updated';
     822
     823                // Limit the Beta tab to plugins updated within 12 months.
     824                $meta_query                = $wp_query->get( 'meta_query' ) ?: [];
     825                $meta_query['live-preview'] = [
     826                    'key'     => '_public_preview',
     827                    'value'   => '1',
     828                    'compare' => '=',
    815829                ];
    816830                $wp_query->set( 'meta_query', $meta_query );
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r13335 r13396  
    183183            $noindex = true;
    184184        } elseif ( get_query_var( 'plugin_business_model' ) && get_query_var( 'browse' ) ) {
     185            $noindex = true;
     186        } elseif ( 'preview' == get_query_var( 'browse' ) ) {
    185187            $noindex = true;
    186188        } elseif ( is_singular( 'plugin' ) && self::is_plugin_outdated() ) {
Note: See TracChangeset for help on using the changeset viewer.