admin管理员组文章数量:1024914
Is it possible to change the title=""
attribute that Wordpress generates with the_author_posts_link()
?
It is currently displaying 'Messages of [User]' as a hover title but I wish to change this to something else.
Is it possible to change the title=""
attribute that Wordpress generates with the_author_posts_link()
?
It is currently displaying 'Messages of [User]' as a hover title but I wish to change this to something else.
Share Improve this question asked May 9, 2019 at 14:37 Kevin M.Kevin M. 638 bronze badges1 Answer
Reset to default 1Yes, it is, but you'll have to use get_author_posts_url()
(see Codex).
The example in the Codex is (not my code):
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>"><?php the_author(); ?></a>
You could add your own title="My Better Title"
in that <a>
tag to make it say whatever you like:
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>" title="My Better Title"><?php the_author(); ?></a>
Replace that with your text or anything you can generate. If you're getting text from somewhere else, be sure to wrap it in esc_attr()
so it doesn't break your HTML.
Is it possible to change the title=""
attribute that Wordpress generates with the_author_posts_link()
?
It is currently displaying 'Messages of [User]' as a hover title but I wish to change this to something else.
Is it possible to change the title=""
attribute that Wordpress generates with the_author_posts_link()
?
It is currently displaying 'Messages of [User]' as a hover title but I wish to change this to something else.
Share Improve this question asked May 9, 2019 at 14:37 Kevin M.Kevin M. 638 bronze badges1 Answer
Reset to default 1Yes, it is, but you'll have to use get_author_posts_url()
(see Codex).
The example in the Codex is (not my code):
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>"><?php the_author(); ?></a>
You could add your own title="My Better Title"
in that <a>
tag to make it say whatever you like:
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>" title="My Better Title"><?php the_author(); ?></a>
Replace that with your text or anything you can generate. If you're getting text from somewhere else, be sure to wrap it in esc_attr()
so it doesn't break your HTML.
本文标签: customizationChanging the theauthorpostslink() hover title
版权声明:本文标题:customization - Changing the the_author_posts_link() hover title 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745508968a2153739.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论