最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - the_author_posts_link css class

programmeradmin0浏览0评论

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?

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?

Share Improve this question edited Sep 8, 2015 at 8:35 birgire 68.1k7 gold badges120 silver badges252 bronze badges asked Sep 8, 2015 at 8:21 rwzdoornrwzdoorn 3856 silver badges24 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 5

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 );
});
发布评论

评论列表(0)

  1. 暂无评论