Skip to content

Instantly share code, notes, and snippets.

@derpixler
Created January 10, 2012 11:04
Show Gist options
  • Save derpixler/1588496 to your computer and use it in GitHub Desktop.
Save derpixler/1588496 to your computer and use it in GitHub Desktop.
Vergib Titel-Tag
<?php
/*
Module Name: Vergib Titel-Tag
Module URI: https://plus.google.com/u/0/116520935691953756105/posts/Bq1iaEzC9h1
Description: Titel-Tag für vorherige und folgende Seiten links
Author: René Reimann
Author URI: http://www.honeymilk.org
*/
/* Sicherheitsabfrage */
if ( !class_exists('Toolbox') ) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
exit();
}
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