Making WordPress.org


Ignore:
Timestamp:
03/11/2024 03:11:46 AM (14 months ago)
Author:
dd32
Message:

wporg-plugins-2024: Inherit the new wide layout.
See https://github.com/WordPress/pattern-directory/issues/634

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins-2024/js/build/blocks/front-page/render.php

    r13244 r13303  
    1717?>
    1818
    19     <main id="main" class="site-main" role="main">
     19<main id="main" class="site-main alignwide" role="main">
    2020
    21         <?php
    22         foreach ( $sections as $browse => $section_title ) :
    23             // Only logged in users can have favorites.
    24             if ( 'favorites' === $browse && ! is_user_logged_in() ) {
    25                 continue;
    26             }
     21    <?php
     22    foreach ( $sections as $browse => $section_title ) :
     23        // Only logged in users can have favorites.
     24        if ( 'favorites' === $browse && ! is_user_logged_in() ) {
     25            continue;
     26        }
    2727
    28             $section_args = array(
    29                 'post_type'      => 'plugin',
    30                 'posts_per_page' => 4,
    31                 'browse'         => $browse,
    32                 'post_status'    => 'publish',
    33             );
     28        $section_args = array(
     29            'post_type'      => 'plugin',
     30            'posts_per_page' => 4,
     31            'browse'         => $browse,
     32            'post_status'    => 'publish',
     33        );
    3434
    35             if ( 'popular' === $browse ) {
    36                 $section_args['meta_key'] = '_active_installs';
    37                 $section_args['orderby']  = 'meta_value_num';
    38                 unset( $section_args['browse'] );
    39             } else if ( 'blocks' === $browse ) {
    40                 $section_args['orderby'] = 'rand';
    41                 $section_args['meta_query'] = [
    42                     [
    43                         'key'     => '_active_installs',
    44                         'value'   => 200,
    45                         'type'    => 'numeric',
    46                         'compare' => '>=',
    47                     ],
    48                     [
    49                         'key'     => 'tested',
    50                         'value'   => Template::get_current_major_wp_version() - 0.2,
    51                         'compare' => '>=',
    52                     ],
    53                 ];
    54             }
     35        if ( 'popular' === $browse ) {
     36            $section_args['meta_key'] = '_active_installs';
     37            $section_args['orderby']  = 'meta_value_num';
     38            unset( $section_args['browse'] );
     39        } else if ( 'blocks' === $browse ) {
     40            $section_args['orderby'] = 'rand';
     41            $section_args['meta_query'] = [
     42                [
     43                    'key'     => '_active_installs',
     44                    'value'   => 200,
     45                    'type'    => 'numeric',
     46                    'compare' => '>=',
     47                ],
     48                [
     49                    'key'     => 'tested',
     50                    'value'   => Template::get_current_major_wp_version() - 0.2,
     51                    'compare' => '>=',
     52                ],
     53            ];
     54        }
    5555
    56             $section_query = new \WP_Query( $section_args );
     56        $section_query = new \WP_Query( $section_args );
    5757
    58             // If the user doesn't have any favorites, omit the section.
    59             if ( 'favorites' === $browse && ! $section_query->have_posts() ) {
    60                 continue;
    61             }
     58        // If the user doesn't have any favorites, omit the section.
     59        if ( 'favorites' === $browse && ! $section_query->have_posts() ) {
     60            continue;
     61        }
     62        ?>
     63
     64        <section class="plugin-section">
     65            <header class="section-header">
     66                <h2 class="section-title"><?php echo esc_html( $section_title ); ?></h2>
     67                <a class="section-link" href="<?php echo esc_url( home_url( "browse/$browse/" ) ); ?>">
     68                    <?php
     69                    printf(
     70                        /* translators: %s: Section title as an accessibility text for screen readers. */
     71                        esc_html_x( 'See all %s', 'plugins', 'wporg-plugins' ),
     72                        '<span class="screen-reader-text">' . esc_html( $section_title ) . '</span>'
     73                    );
     74                    ?>
     75                </a>
     76            </header>
     77
     78            <?php
     79            while ( $section_query->have_posts() ) :
     80                $section_query->the_post();
     81
     82                get_template_part( 'template-parts/plugin', 'index' );
     83            endwhile;
    6284            ?>
     85        </section>
    6386
    64             <section class="plugin-section">
    65                 <header class="section-header">
    66                     <h2 class="section-title"><?php echo esc_html( $section_title ); ?></h2>
    67                     <a class="section-link" href="<?php echo esc_url( home_url( "browse/$browse/" ) ); ?>">
    68                         <?php
    69                         printf(
    70                             /* translators: %s: Section title as an accessibility text for screen readers. */
    71                             esc_html_x( 'See all %s', 'plugins', 'wporg-plugins' ),
    72                             '<span class="screen-reader-text">' . esc_html( $section_title ) . '</span>'
    73                         );
    74                         ?>
    75                     </a>
    76                 </header>
     87    <?php endforeach; ?>
    7788
    78                 <?php
    79                 while ( $section_query->have_posts() ) :
    80                     $section_query->the_post();
     89</main><!-- #main -->
    8190
    82                     get_template_part( 'template-parts/plugin', 'index' );
    83                 endwhile;
    84                 ?>
    85             </section>
     91<aside id="secondary" class="widget-area" role="complementary">
     92    <?php
     93    the_widget( 'WP_Widget_Text', array(
     94        'title' => __( 'Add Your Plugin', 'wporg-plugins' ),
     95        'text'  => sprintf(
     96            /* translators: URL to Developers page. */
     97            __( 'The WordPress Plugin Directory is the largest directory of free and open source WordPress plugins. Find out how to <a href="%s">host your plugin</a> on WordPress.org.', 'wporg-plugins' ),
     98            esc_url( home_url( 'developers' ) )
     99        ),
     100    ), $widget_args );
    86101
    87         <?php endforeach; ?>
     102    the_widget( 'WP_Widget_Text', array(
     103        'title' => __( 'Create a Plugin', 'wporg-plugins' ),
     104        'text'  => sprintf(
     105            /* translators: URL to Developer Handbook. */
     106            __( 'Building a plugin has never been easier. Read through the <a href="%s">Plugin Developer Handbook</a> to learn all about WordPress plugin development.', 'wporg-plugins' ),
     107            esc_url( 'https://developer.wordpress.org/plugins/' )
     108        ),
     109    ), $widget_args );
    88110
    89     </main><!-- #main -->
    90 
    91     <aside id="secondary" class="widget-area" role="complementary">
    92         <?php
    93         the_widget( 'WP_Widget_Text', array(
    94             'title' => __( 'Add Your Plugin', 'wporg-plugins' ),
    95             'text'  => sprintf(
    96                 /* translators: URL to Developers page. */
    97                 __( 'The WordPress Plugin Directory is the largest directory of free and open source WordPress plugins. Find out how to <a href="%s">host your plugin</a> on WordPress.org.', 'wporg-plugins' ),
    98                 esc_url( home_url( 'developers' ) )
    99             ),
    100         ), $widget_args );
    101 
    102         the_widget( 'WP_Widget_Text', array(
    103             'title' => __( 'Create a Plugin', 'wporg-plugins' ),
    104             'text'  => sprintf(
    105                 /* translators: URL to Developer Handbook. */
    106                 __( 'Building a plugin has never been easier. Read through the <a href="%s">Plugin Developer Handbook</a> to learn all about WordPress plugin development.', 'wporg-plugins' ),
    107                 esc_url( 'https://developer.wordpress.org/plugins/' )
    108             ),
    109         ), $widget_args );
    110 
    111         the_widget( 'WP_Widget_Text', array(
    112             'title' => __( 'Stay Up-to-Date', 'wporg-plugins' ),
    113             'text'  => sprintf(
    114                 /* translators: URL to make/plugins site. */
    115                 __( 'Plugin development is constantly changing with each new WordPress release. Keep up with the latest changes by following the <a href="%s">Plugin Review Team&#8217;s blog</a>.', 'wporg-plugins' ),
    116                 esc_url( 'https://make.wordpress.org/plugins/' )
    117             ),
    118         ), $widget_args );
    119         ?>
    120     </aside><!-- #secondary -->
     111    the_widget( 'WP_Widget_Text', array(
     112        'title' => __( 'Stay Up-to-Date', 'wporg-plugins' ),
     113        'text'  => sprintf(
     114            /* translators: URL to make/plugins site. */
     115            __( 'Plugin development is constantly changing with each new WordPress release. Keep up with the latest changes by following the <a href="%s">Plugin Review Team&#8217;s blog</a>.', 'wporg-plugins' ),
     116            esc_url( 'https://make.wordpress.org/plugins/' )
     117        ),
     118    ), $widget_args );
     119    ?>
     120</aside><!-- #secondary -->
Note: See TracChangeset for help on using the changeset viewer.