Changes between Version 1 and Version 2 of Ticket #55751, comment 7
- Timestamp:
- 06/07/2022 03:26:45 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #55751, comment 7
v1 v2 17 17 18 18 19 {{{the_posts_navigation( array( 19 20 {{{ 21 the_posts_navigation( array( 20 22 'prev_text' => 'Prev', 21 23 'next_text' => 'Next', 22 ) );}}} 24 ) ); 25 }}} 26 23 27 24 28 25 29 2. Add filter for `next_posts_link_attributes` in functions.php: 26 30 27 {{{add_filter( 'next_posts_link_attributes', function () { 31 32 {{{ 33 add_filter( 'next_posts_link_attributes', function () { 28 34 return 'data-pagination="next-posts"'; 29 } );}}} 35 } ); 36 }}} 37 30 38 31 39 3. Add filter for `previous_posts_link_attributes` in functions.php: 32 40 33 {{{add_filter( 'previous_posts_link_attributes', function () { 41 42 {{{ 43 add_filter( 'previous_posts_link_attributes', function () { 34 44 return 'data-pagination="prev-posts"'; 35 } );}}} 45 } ); 46 }}} 47 36 48 37 49 This is the HTML output from the code above, which shows the attributes are not applied to the correct link. 38 50 39 {{{<nav class="navigation posts-navigation" aria-label="Posts"> 51 52 {{{ 53 <nav class="navigation posts-navigation" aria-label="Posts"> 40 54 <h2 class="screen-reader-text">Posts navigation</h2> 41 55 <div class="nav-links"> … … 43 57 <div class="nav-next"><a href="http://website.test/2020/" data-pagination="prev-posts">Next</a></div> 44 58 </div> 45 </nav>}}} 59 </nav> 60 }}}
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)