[wp-hackers] Adding the class next_post_link
Lionel POINTET
lionel.pointet at globalis-ms.com
Tue Apr 3 17:51:00 UTC 2012
Hi Leo,
The two functions next_post_link and previous_post_link use actually the
same one called adjacent_post_link.
This function provide one unique filter: "{$adjacent}_post_link" where
$adjacent value will be "next" or "previous" based on the caller.
The value you'll filter with it will be the entire generated HTML code (<a
href...>Title</a>), so you will be able to add your own classes by doing a
str_replace or so on that value.
You could also add a wrapper for those functions in your theme, as
twentyeleven is doing in the single.php template:
<span class="nav-previous"><?php previous_post_link( '%link', __( '<span
class="meta-nav">←</span> Previous', 'twentyeleven' ) ); ?></span>
In that case, a CSS rule with something like ".nav-previous a" will trigger
your link.
Hope that helps.
Lionel
2012/4/3 Leo Baiano <ljunior2005 at gmail.com>
> Guys, I need to add a link to the class generated by next_post_link
> previous_post_link and I saw that for next_posts_link can do this with the
> filter next_posts_link_attributes, but ran the codex and did not find one
> similar to next_post_link.
>
> Any help in this regard?
>
> --
> Amplexos,
>
> Leo Baiano
> http://www.leobaiano.com
> http://www.blog.ljunior.com
> http://www.mcelebridades.com
> http://www.twitter.com/leobaiano
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list