添加标题属性以继续阅读链接(wp)
我有一个“继续阅读”功能,如下所示:
function twentyten_continue_reading_link() {
global $id;
return ' <span class="readmore"><a href="'. get_permalink($id) . '">' . __( 'Read More <span class="meta-nav">»</span>', 'twentyten' ) . '</a></span>';
}
我想添加一个标题属性,我认为该属性应该如下所示,
title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"
但我不确定如何在上述函数中插入标题以使其正常工作正确。有人可以帮我纠正语法吗?
I have a 'Continue Reading' function that looks like this:
function twentyten_continue_reading_link() {
global $id;
return ' <span class="readmore"><a href="'. get_permalink($id) . '">' . __( 'Read More <span class="meta-nav">»</span>', 'twentyten' ) . '</a></span>';
}
I want to add a title attribute, which I think should look something like this
title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"
but I'm not sure exactly how to insert the title in the above function to get it to work correctly. Can somebody help me get the syntax right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://codex.wordpress.org/Function_Reference/the_title_attribute#Example
< ;a href="" title=" '固定链接到:', 'after' => '')); ?>">
既然你想返回它,你可能需要这样的东西:
http://codex.wordpress.org/Function_Reference/the_title_attribute#Example
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute( array('before' => 'Permalink to: ', 'after' => '')); ?>"><?php the_title(); ?></a>
Since you want to return it, you probably need something like this: