Created
May 30, 2009 18:11
-
-
Save singpolyma/120586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- link-template.php 2009-01-24 01:33:37.000000000 -0800 | |
+++ link-template.php 2009-05-30 11:10:41.000000000 -0700 | |
@@ -950,6 +950,9 @@ | |
else | |
$post = get_adjacent_post($in_same_cat, $excluded_categories, $previous); | |
+ $rel = 'next'; | |
+ if($previous) $rel = 'prev'; | |
+ | |
if ( !$post ) | |
return; | |
@@ -961,7 +964,7 @@ | |
$title = apply_filters('the_title', $title, $post); | |
$date = mysql2date(get_option('date_format'), $post->post_date); | |
- $string = '<a href="'.get_permalink($post).'">'; | |
+ $string = '<a rel="'.$rel.'" href="'.get_permalink($post).'">'; | |
$link = str_replace('%title', $title, $link); | |
$link = str_replace('%date', $date, $link); | |
$link = $string . $link . '</a>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: rel=prev/next | |
Plugin URI: http://singpolyma.net/plugins/ | |
Description: Adds rel/prev/next to next/previous posts links | |
Version: 0.1 | |
Author: Stephen Paul Weber | |
Author URI: http://singpolyma.net | |
License: MIT license (http://www.opensource.org/licenses/mit-license.php) | |
*/ | |
add_filter('next_posts_link_attributes', 'get_next_posts_link_attributes'); | |
add_filter('previous_posts_link_attributes', 'get_previous_posts_link_attributes'); | |
if (!function_exists('get_next_posts_link_attributes')){ | |
function get_next_posts_link_attributes($attr){ | |
$attr .= 'rel="prev"'; | |
return $attr; | |
} | |
} | |
if (!function_exists('get_previous_posts_link_attributes')){ | |
function get_previous_posts_link_attributes($attr){ | |
$attr .= 'rel="next"'; | |
return $attr; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thats work, nice but need to little change 'rel="prev"'; to 'rel="next"';
to
use it on www.whatisthewik.com and work, thanks singpolyma