WordPress.org

Making WordPress.org

Changeset 4283


Ignore:
Timestamp:
10/21/2016 08:30:29 PM (4 years ago)
Author:
coffee2code
Message:

Plugin Directory: Add 'My Favorites' section to the front page if the user is logged in and has favorites.

Fixes #2156.

File:
1 edited

Legend:

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

    r4223 r4283  
    1414    'popular'  => __( 'Popular Plugins', 'wporg-plugins' ),
    1515    'beta'     => __( 'Beta Plugins', 'wporg-plugins' ),
     16    'favorites' => __( 'My Favorites', 'wporg-plugins' ),
    1617);
    1718
     
    2728
    2829        <?php foreach ( $sections as $browse => $section_title ) :
     30            // Only logged in users can have favorites.
     31            if ( 'favorites' === $browse && ! is_user_logged_in() ) {
     32                continue;
     33            }
     34
    2935            $section_args = array(
    3036                'post_type'      => 'plugin',
     
    4046
    4147            $section_query = new \WP_Query( $section_args );
     48
     49            // If the user doesn't have any favorites, omit the section.
     50            if ( 'favorites' === $browse && ! $section_query->have_posts() ) {
     51                continue;
     52            }
    4253            ?>
    4354
Note: See TracChangeset for help on using the changeset viewer.