[wp-trac] [WordPress Trac] #45920: Twenty Nineteen: Add fragment ID to paginated links

WordPress Trac noreply at wordpress.org
Fri Jan 11 06:24:20 UTC 2019


#45920: Twenty Nineteen: Add fragment ID to paginated links
---------------------------+------------------------------
 Reporter:  laurelfulford  |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Bundled Theme  |     Version:  5.0.2
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:
---------------------------+------------------------------
Changes (by mukesh27):

 * keywords:  needs-patch => has-patch


Comment:

 @laurelfulford and @joyously above code is not working for **Plain**
 permalink structure. please try below code also attached patch for same in
 theme.

 {{{
 /**
  * Add a fragment identifier (to the content) to paginated links.
  */
 function twentynineteen_link_pages_link( $link, $i ) {
         if ( $i > 1 && preg_match( '/href="([^"]*)"/', $link, $matches ) )
 {
                 $link = str_replace( $matches[1], $matches[1] .
 '#content', $link );
         }
         return $link;
 }
 add_filter( 'wp_link_pages_link', 'twentynineteen_link_pages_link', 10, 2
 );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45920#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list