Make WordPress Core

Ticket #30589: 30589.twentyfifteen.diff

File 30589.twentyfifteen.diff, 2.0 KB (added by obenland, 11 years ago)

Proof-of-concept: Custom code reduction in Twenty Fifteen.

  • src/wp-content/themes/twentyfifteen/comments.php

     
    3030                        ?>
    3131                </h2>
    3232
    33                 <?php twentyfifteen_comment_nav(); ?>
     33                <?php the_comments_navigation(); ?>
    3434
    3535                <ol class="comment-list">
    3636                        <?php
     
    4242                        ?>
    4343                </ol><!-- .comment-list -->
    4444
    45                 <?php twentyfifteen_comment_nav(); ?>
     45                <?php the_comments_navigation(); ?>
    4646
    4747        <?php endif; // have_comments() ?>
    4848
  • src/wp-content/themes/twentyfifteen/inc/template-tags.php

     
    99 * @since Twenty Fifteen 1.0
    1010 */
    1111
    12 if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) :
    13 /**
    14  * Display navigation to next/previous comments when applicable.
    15  *
    16  * @since Twenty Fifteen 1.0
    17  */
    18 function twentyfifteen_comment_nav() {
    19         // Are there comments to navigate through?
    20         if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
    21         ?>
    22         <nav class="navigation comment-navigation" role="navigation">
    23                 <h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfifteen' ); ?></h2>
    24                 <div class="nav-links">
    25                         <?php
    26                                 if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) :
    27                                         printf( '<div class="nav-previous">%s</div>', $prev_link );
    28                                 endif;
    29 
    30                                 if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) :
    31                                         printf( '<div class="nav-next">%s</div>', $next_link );
    32                                 endif;
    33                         ?>
    34                 </div><!-- .nav-links -->
    35         </nav><!-- .comment-navigation -->
    36         <?php
    37         endif;
    38 }
    39 endif;
    40 
    4112if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) :
    4213/**
    4314 * Prints HTML with meta information for the categories, tags.