WordPress.org

Make WordPress Core

Ticket #32618: 32618.diff

File 32618.diff, 2.4 KB (added by ChaseWiseman, 6 years ago)
  • src/wp-includes/link-template.php

    diff --git src/wp-includes/link-template.php src/wp-includes/link-template.php
    index a09dfdb..20bcb44 100644
    function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) { 
    22612261 * @param array $args {
    22622262 *     Optional. Default post navigation arguments. Default empty array.
    22632263 *
    2264  *     @type string $prev_text          Anchor text to display in the previous post link. Default `%title`.
    2265  *     @type string $next_text          Anchor text to display in the next post link. Default `%title`.
    2266  *     @type string $screen_reader_text Screen reader text for nav element. Default 'Post navigation'.
     2264 *     @type string       $prev_text          Anchor text to display in the previous post link. Default `%title`.
     2265 *     @type string       $next_text          Anchor text to display in the next post link. Default `%title`.
     2266 *     @type bool         $in_same_term       Whether link should be in a same taxonomy term. Default `false`.
     2267 *     @type array|string $excluded_terms     Array or comma-separated list of excluded term IDs. Default empty.
     2268 *     @type string       $taxonomy           Taxonomy, if $in_same_term is true. Default `category`.
     2269 *     @type string       $screen_reader_text Screen reader text for nav element. Default 'Post navigation'.
    22672270 * }
    22682271 * @return string Markup for post links.
    22692272 */
    function get_the_post_navigation( $args = array() ) { 
    22712274        $args = wp_parse_args( $args, array(
    22722275                'prev_text'          => '%title',
    22732276                'next_text'          => '%title',
     2277                'in_same_term'       => false,
     2278                'excluded_terms'     => '',
     2279                'taxonomy'           => 'category',
    22742280                'screen_reader_text' => __( 'Post navigation' ),
    22752281        ) );
    22762282
    22772283        $navigation = '';
    2278         $previous   = get_previous_post_link( '<div class="nav-previous">%link</div>', $args['prev_text'] );
    2279         $next       = get_next_post_link( '<div class="nav-next">%link</div>', $args['next_text'] );
     2284        $previous   = get_previous_post_link( '<div class="nav-previous">%link</div>', $args['prev_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy'] );
     2285        $next       = get_next_post_link( '<div class="nav-next">%link</div>', $args['next_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy'] );
    22802286
    22812287        // Only add markup if there's somewhere to navigate to.
    22822288        if ( $previous || $next ) {