mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Twenty Nineteen: Add fragment ID to paginated links.
This changeset adds the `#content` fragment identifier to paginated links so the screen scrolls down to the content section when clicking on pagination links located on paginated pages. Props laurelfulford, mukesh27, joyously, poena, alvitazwar052, oglekler, audrasjb. Fixes #45920. Built from https://develop.svn.wordpress.org/trunk@56057 git-svn-id: http://core.svn.wordpress.org/trunk@55569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
37ebdb8fa1
commit
e96961f861
@ -223,3 +223,20 @@ function twentynineteen_add_mobile_parent_nav_menu_items( $sorted_menu_items, $a
|
||||
return $amended_menu_items;
|
||||
}
|
||||
add_filter( 'wp_nav_menu_objects', 'twentynineteen_add_mobile_parent_nav_menu_items', 10, 2 );
|
||||
|
||||
/**
|
||||
* Adds a fragment identifier (to the content) to paginated links.
|
||||
*
|
||||
* @since Twenty Nineteen 2.6
|
||||
*
|
||||
* @param string $link The page number HTML output.
|
||||
* @param int $i Page number for paginated posts' page links.
|
||||
* @return string Formatted output in HTML.
|
||||
*/
|
||||
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 );
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-56056';
|
||||
$wp_version = '6.3-alpha-56057';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user