Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #55751, comment 7


Ignore:
Timestamp:
06/07/2022 03:26:45 PM (4 years ago)
Author:
jongycastillo

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #55751, comment 7

    v1 v2  
    1717
    1818
    19 {{{the_posts_navigation( array(
     19
     20{{{
     21the_posts_navigation( array(
    2022    'prev_text' => 'Prev',
    2123    'next_text' => 'Next',
    22 ) );}}}
     24) );
     25}}}
     26
    2327
    2428
    25292. Add filter for `next_posts_link_attributes` in functions.php:
    2630
    27 {{{add_filter( 'next_posts_link_attributes', function () {
     31
     32{{{
     33add_filter( 'next_posts_link_attributes', function () {
    2834    return 'data-pagination="next-posts"';
    29 } );}}}
     35} );
     36}}}
     37
    3038
    31393. Add filter for `previous_posts_link_attributes` in functions.php:
    3240
    33 {{{add_filter( 'previous_posts_link_attributes', function () {
     41
     42{{{
     43add_filter( 'previous_posts_link_attributes', function () {
    3444    return 'data-pagination="prev-posts"';
    35 } );}}}
     45} );
     46}}}
     47
    3648
    3749This is the HTML output from the code above, which shows the attributes are not applied to the correct link.
    3850
    39 {{{<nav class="navigation posts-navigation" aria-label="Posts">
     51
     52{{{
     53<nav class="navigation posts-navigation" aria-label="Posts">
    4054    <h2 class="screen-reader-text">Posts navigation</h2>
    4155    <div class="nav-links">
    … …  
    4357        <div class="nav-next"><a href="http://website.test/2020/" data-pagination="prev-posts">Next</a></div>
    4458    </div>
    45 </nav>}}}
     59</nav>
     60}}}