Skip to content

Instantly share code, notes, and snippets.

@derpixler
Created January 9, 2012 09:15
Show Gist options
  • Save derpixler/1582122 to your computer and use it in GitHub Desktop.
Save derpixler/1582122 to your computer and use it in GitHub Desktop.
add Linktitle to Prev and Next Link
function add_rr_linktitle( $format, $link = FALSE ){
if( $link )
$nex_prev = true;
preg_match_all( '/<a href="(.*?)" rel="(.*?)">(.*?)<\/a>/', $format, $matches);
return '<a href="' . $matches[1][0] . '" rel="' . $matches[2][0] . '" title="' . get_adjacent_post( false, '', $nex_prev )->post_title . '">' . $matches[3][0] . '</a> ';
}
add_filter( 'previous_post_link', 'add_rr_linktitle', 9, 2 );
add_filter( 'next_post_link', 'add_rr_linktitle', 9, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment