• Resolved Leroy12

    (@leroy12)


    Hi,
    I’m trying to customize the display of “next_posts_link” / “previous_posts_link”. By looking at the definition of those functions in the WordPress code, I found the following piece of code:

    $attr = apply_filters( ‘next_posts_link_attributes’, ” );
    return ‘“. preg_replace(‘/&([^#])(?![a-z]{1,8};)/’, ‘&$1′, $label) .’‘;

    It suggests links generated by those methods can be customized with a filter named “next_posts_link_attributes”.

    However, I have no clue how to use this filter to pass attributes (simply a classname) to the < A > HTML tag.

    Any clue how I could do this?

    Thanks,
    Nicolas

Viewing 1 replies (of 1 total)
  • Thread Starter Leroy12

    (@leroy12)

    Ok, got it. I’ve added the following code in my “functions.php” file.

    function next_posts_link_css($content) { echo ‘ici’;
    return ‘class=”btng”‘;
    }

    add_filter(‘next_posts_link_attributes’, ‘next_posts_link_css’ );

Viewing 1 replies (of 1 total)

The topic ‘Customizing the display of “next_posts_link” / “previous_posts_link”’ is closed to new replies.