Currently I’m styling as project where I need to add a custom CSS to the_author_posts_link().

I want to add the class “blog-link” with the the_author_posts_link() . How do I add a css class to it?

1 Answer
1

You can use the the_author_posts_link filter to add the custom blog-link class:

/**
 * Add the 'blog-link' class to the output of the_author_posts_link()
 */
add_filter( 'the_author_posts_link', function( $link )
{
    return str_replace( 'rel="author"', 'rel="author" class="blog-link"', $link );
});

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *