Does someone perhaps know a plugin or snippet (besides Yoast's WordPress SEO) to accomplish this perhaps? Pagination with rel=“next” and rel=“prev”
The only thing I've come across seems to be an 3-month old Trac ticket.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityDoes someone perhaps know a plugin or snippet (besides Yoast's WordPress SEO) to accomplish this perhaps? Pagination with rel=“next” and rel=“prev”
The only thing I've come across seems to be an 3-month old Trac ticket.
Try putting this snippet in your functions.php
<?php
function rel_next_prev(){
global $paged;
if ( get_previous_posts_link() ) { ?>
<link rel="prev" href="<?php echo get_pagenum_link( $paged - 1 ); ?>" /><?php
}
if ( get_next_posts_link() ) { ?>
<link rel="next" href="<?php echo get_pagenum_link( $paged +1 ); ?>" /><?php
}
}
add_action( 'wp_head', 'rel_next_prev' );
?>
And if you don't want the next and prev rel links to show up on the singular pages just wrap the output markup in a !is_singular()
if condition
is_archive()
instead of ! is_singular()
May 8, 2014 at 21:43
get_next_posts_link()
not working without the max_num_pages
parameter, how can I get this variable in functions.php? am I missing something ?
This pretty much does exactly that, as a plugin - http://wordpress.org/extend/plugins/pagination-rel-links/
Ok then this will be a good solution:
$('YOUR_PAGINATION_A_ID').attr('rel', 'next');
$('YOUR_PAGINATION_A_ID').attr('rel', 'prev');
Try this, it might help you.