添加title属性以继续阅读链接(wp)


add title attribute to continue reading link (wp)

我有一个"继续阅读"功能,看起来像这样:

function twentyten_continue_reading_link() {
global $id;
return ' <span class="readmore"><a href="'. get_permalink($id) . '">' . __( 'Read More <span class="meta-nav">&#187;</span>', 'twentyten' ) . '</a></span>';
}

我想添加一个标题属性,我认为它应该看起来像这个

title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"

但我不确定如何在上面的函数中插入标题以使其正确工作。有人能帮我把语法弄对吗?

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>

既然你想退货,你可能需要这样的东西:

return '<a href="' . get_permalink(); . ' title="' . the_title_attribute( array('echo' => 0, 'before' => 'Permalink to: ', 'after' => '')) . the_title() . '>';