WordPress.org

Make WordPress Core

Ticket #45920: 45920.diff

File 45920.diff, 794 bytes (added by mukesh27, 3 years ago)

Patch tested for Plain, Day and name, Month and name, Numeric, Post name and Custom Structure permalink structures.

  • wp-content/themes/twentynineteen/inc/template-functions.php

    diff --git a/wp-content/themes/twentynineteen/inc/template-functions.php b/wp-content/themes/twentynineteen/inc/template-functions.php
    index 2dbd0c5..3ceede6 100644
    a b function twentynineteen_hsl_hex( $h, $s, $l, $to_hex = true ) { 
    419419
    420420        return "rgb($r, $g, $b)";
    421421}
     422
     423/**
     424 * Add a fragment identifier (to the content) to paginated links.
     425 */
     426function twentynineteen_link_pages_link( $link, $i ) {
     427        if ( $i > 1 && preg_match( '/href="([^"]*)"/', $link, $matches ) ) {
     428                $link = str_replace( $matches[1], $matches[1] . '#content', $link );
     429        }
     430        return $link;
     431}
     432add_filter( 'wp_link_pages_link', 'twentynineteen_link_pages_link', 10, 2 );