Make WordPress Core

Ticket #30189: 30189.diff

File 30189.diff, 8.5 KB (added by obenland, 10 years ago)
  • src/wp-content/themes/twentyfifteen/archive.php

     
    100100
    101101                        <?php endwhile; ?>
    102102
    103                         <?php twentyfifteen_paging_nav(); ?>
     103                        <?php
     104                                the_pagination( array(
     105                                        'before_page_number' => '<span class="meta-nav">' . __( 'Page', 'twentyfifteen' ) . '</span>',
     106                                ) );
     107                        ?>
    104108
    105109                <?php else : ?>
    106110
  • src/wp-content/themes/twentyfifteen/functions.php

     
    277277
    278278        if ( $previous &&  has_post_thumbnail( $previous->ID ) ) {
    279279                $prevthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $previous->ID ), 'post-thumbnail' );
    280                 $css .= '.post-navigation .nav-previous { background-image: url(' . esc_url( $prevthumb[0] ) . '); }';
     280                $css .= '
     281                        .post-navigation .nav-previous { background-image: url(' . esc_url( $prevthumb[0] ) . '); }
     282                        .post-navigation .nav-previous .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; }
     283                        .post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); }
     284                ';
    281285        }
    282286
    283287        if ( $next && has_post_thumbnail( $next->ID ) ) {
    284288                $nextthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $next->ID ), 'post-thumbnail' );
    285                 $css .= '.post-navigation .nav-next { background-image: url(' . esc_url( $nextthumb[0] ) . '); }';
     289                $css .= '
     290                        .post-navigation .nav-next { background-image: url(' . esc_url( $nextthumb[0] ) . '); }
     291                        .post-navigation .nav-next .post-title, .post-navigation .nav-next .meta-nav { color: #fff; }
     292                        .post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); }
     293                ';
    286294        }
    287295
    288296        wp_add_inline_style( 'twentyfifteen-style', $css );
  • src/wp-content/themes/twentyfifteen/inc/template-tags.php

     
    99 * @since Twenty Fifteen 1.0
    1010 */
    1111
    12 if ( ! function_exists( 'twentyfifteen_paging_nav' ) ) :
    13 /**
    14  * Display navigation to next/previous set of posts when applicable.
    15  *
    16  * @since Twenty Fifteen 1.0
    17  * @uses paginate_links()
    18  *
    19  * @global WP_Query $wp_query WordPress Query object.
    20  */
    21 function twentyfifteen_paging_nav() {
    22         // Don't print empty markup if there's only one page.
    23         if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
    24                 return;
    25         }
    26 
    27         // Set up paginated links.
    28         $links = paginate_links( array(
    29                 'prev_text'          => esc_html__( 'Previous', 'twentyfifteen' ),
    30                 'next_text'          => esc_html__( 'Next', 'twentyfifteen' ),
    31                 'before_page_number' => '<span class="meta-nav">' . esc_html__( 'Page', 'twentyfifteen' ) . '</span>',
    32         ) );
    33 
    34         if ( $links ) :
    35         ?>
    36         <nav class="navigation pagination" role="navigation">
    37                 <h2 class="screen-reader-text"><?php esc_html_e( 'Posts navigation', 'twentyfifteen' ); ?></h2>
    38                 <div class="nav-links">
    39                         <?php echo $links; ?>
    40                 </div><!-- .nav-links -->
    41         </nav><!-- .pagination -->
    42         <?php
    43         endif;
    44 }
    45 endif;
    46 
    47 if ( ! function_exists( 'twentyfifteen_post_nav' ) ) :
    48 /**
    49  * Display navigation to next/previous post when applicable.
    50  *
    51  * @since Twenty Fifteen 1.0
    52  */
    53 function twentyfifteen_post_nav() {
    54         // Don't print empty markup if there's nowhere to navigate.
    55         $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
    56         $next     = get_adjacent_post( false, '', false );
    57 
    58         if ( ( ! $next && ! $previous ) || ( is_attachment() && 'attachment' == $previous->post_type ) ) {
    59                 return;
    60         }
    61 
    62         $prev_class = $next_class = '';
    63 
    64         if ( $previous && has_post_thumbnail( $previous->ID ) ) {
    65                 $prev_class = ' has-post-thumbnail';
    66         }
    67 
    68         if ( $next && has_post_thumbnail( $next->ID ) ) {
    69                 $next_class = ' has-post-thumbnail';
    70         }
    71 
    72         ?>
    73         <nav class="navigation post-navigation" role="navigation">
    74                 <h2 class="screen-reader-text"><?php esc_html_e( 'Post navigation', 'twentyfifteen' ); ?></h2>
    75                 <div class="nav-links">
    76                         <?php
    77                         if ( is_attachment() ) :
    78                                 previous_post_link( '<div class="nav-previous' . $prev_class . '">%link</div>', _x( '<span class="meta-nav">Published In</span><span class="post-title">%title</span>', 'Parent post link', 'twentyfifteen' ) );
    79                         else :
    80                                 previous_post_link( '<div class="nav-previous' . $prev_class . '">%link</div>', _x( '<span class="meta-nav">Previous</span><span class="post-title">%title</span>', 'Previous post link', 'twentyfifteen' ) );
    81                                 next_post_link( '<div class="nav-next' . $next_class . '">%link</div>', _x( '<span class="meta-nav">Next</span><span class="post-title">%title</span>', 'Next post link', 'twentyfifteen' ) );
    82                         endif;
    83                         ?>
    84                 </div><!-- .nav-links -->
    85         </nav><!-- .post-navigation -->
    86         <?php
    87 }
    88 endif;
    89 
    9012if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) :
    9113/**
    9214 * Display navigation to next/previous comments when applicable.
  • src/wp-content/themes/twentyfifteen/index.php

     
    4040
    4141                        <?php endwhile; ?>
    4242
    43                         <?php twentyfifteen_paging_nav(); ?>
     43                        <?php
     44                                the_pagination( array(
     45                                        'before_page_number' => '<span class="meta-nav">' . __( 'Page', 'twentyfifteen' ) . '</span>',
     46                                ) );
     47                        ?>
    4448
    4549                <?php else : ?>
    4650
  • src/wp-content/themes/twentyfifteen/search.php

     
    3232
    3333                        <?php endwhile; ?>
    3434
    35                         <?php twentyfifteen_paging_nav(); ?>
     35                        <?php
     36                                the_pagination( array(
     37                                        'before_page_number' => '<span class="meta-nav">' . __( 'Page', 'twentyfifteen' ) . '</span>',
     38                                ) );
     39                        ?>
    3640
    3741                <?php else : ?>
    3842
  • src/wp-content/themes/twentyfifteen/single.php

     
    2323                                endif;
    2424                        ?>
    2525
    26                         <?php twentyfifteen_post_nav(); ?>
     26                        <?php the_post_navigation( array(
     27                                'next_text' => _x( '<span class="meta-nav">Previous</span><span class="post-title">%title</span>', 'Previous post link', 'twentyfifteen' ),
     28                                'prev_text' => _x( '<span class="meta-nav">Next</span><span class="post-title">%title</span>', 'Next post link', 'twentyfifteen' ),
     29                        ) ); ?>
    2730
    2831                <?php endwhile; // end of the loop. ?>
    2932
  • src/wp-content/themes/twentyfifteen/style.css

     
    933933        z-index: 2;
    934934}
    935935
    936 .post-navigation a:hover .post-title,
    937 .post-navigation a:focus .post-title {
    938         color: #707070;
    939         color: rgba(51, 51, 51, 0.7);
    940 }
    941 
    942 .post-navigation .has-post-thumbnail {
     936.post-navigation .nav-next,
     937.post-navigation .nav-previous {
    943938        background-position: center;
    944939        background-size: cover;
    945940        position: relative;
    946941}
    947942
    948 .post-navigation .has-post-thumbnail a:before {
    949         background-color: rgba(0, 0, 0, 0.4);
     943.post-navigation a:before {
    950944        content: "";
    951945        display: block;
    952946        height: 100%;
     
    957951        z-index: 1;
    958952}
    959953
    960 .post-navigation .has-post-thumbnail a:hover:before,
    961 .post-navigation .has-post-thumbnail a:focus:before {
    962         background-color: rgba(0, 0, 0, 0.2);
    963 }
    964 
    965 .post-navigation .has-post-thumbnail a:hover .post-title,
    966 .post-navigation .has-post-thumbnail a:focus .post-title {
    967         color: #fff;
    968 }
    969 
    970 .post-navigation .has-post-thumbnail .post-title,
    971 .post-navigation .has-post-thumbnail .meta-nav {
    972         color: #fff;
     954.post-navigation a:hover:before,
     955.post-navigation a:focus:before {
     956        opacity: 0.5;
    973957}
    974958
    975 .post-navigation .has-post-thumbnail .meta-nav {
     959.post-navigation .meta-nav {
    976960        opacity: 0.8;
    977961}
    978962
    979 .post-navigation .nav-previous:not(.has-post-thumbnail) + .nav-next:not(.has-post-thumbnail) {
     963.post-navigation .nav-previous + .nav-next {
    980964        border-top: 1px solid #eaeaea;
    981965        border-top: 1px solid rgba(51, 51, 51, 0.1);
    982966}