Making WordPress.org

Changeset 11553


Ignore:
Timestamp:
02/15/2022 12:40:18 AM (5 years ago)
Author:
coffee2code
Message:

Photo Directory: Change front page navigation markup.

  • Navigation is now to front page pagination rather than to photo post type archive
  • Use native functions to generate more standard navigation markup
  • Add navigation to non-first page paginations

Props topher1kenobe, mdburnette, coffee2code.
Fixes #6034.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-photos
Files:
2 edited

Legend:

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

    r11459 r11553  
    4747        ?>
    4848
    49         <?php if ( $query_total === $GLOBALS['wp_query']->query_vars['posts_per_page'] ) : ?>
    50         <div class="photos-all-links navigation"><a href="<?php echo esc_url( get_post_type_archive_link( get_photo_post_type() ) ); ?>"><?php _e( 'See more photos&rarr;', 'wporg-photos' ); ?></a></div>
    51         <?php endif; ?>
    52 
     49        <?php if ( ! is_paged() && $GLOBALS['wp_query']->max_num_pages > 1 ) : ?>
     50                <?php
     51                $link = '<div class="nav-next">' . get_next_posts_link( __( 'See more photos&rarr;', 'wporg-photos' ) ) . '</div>';
     52                echo _navigation_markup( $link, 'posts-navigation', __( 'Photos navigation', 'wporg-photos' ) ); ?>
     53        <?php else :
     54                the_posts_pagination();
     55        endif;
     56        ?>
    5357        </main><!-- #main -->
    5458
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-photos/functions.php

    r11550 r11553  
    321321
    322322        // Set the number of photos to appear per page in the photos archive.
    323         if ( is_post_type_archive( $post_type ) ) {
     323        if ( is_post_type_archive( $post_type ) || ( is_home() && is_paged() ) ) {
    324324                $query->set( 'posts_per_page', 30 );
    325325        }
Note: See TracChangeset for help on using the changeset viewer.