I’m having a bit of trouble getting my previous_post_link
and next_post_link
‘s to have title attributes.
I’m passing them along like this:
<div class="previous <?php if(!get_previous_post()){ echo 'inactive'; }?>">
<?php previous_post_link('%link', true); ?>
</div>
<div class="next <?php if(!get_next_post()){ echo 'inactive'; }?>">
<?php next_post_link('%link', true); ?>
</div>
Optimally, I’d love to get this as an output:
<a href="previous/post/page.html" title="That posts title">previous post</a>
Is there a parameter that I’m missing? Or is something like this not achieveable?
edit: for clarification
in wordpress
posts_nav_link()
, displays both the Previous and Next links,or if you want both previous and next post link seperately,
here is the code,
it displays text “previous post:” as link along with post title.
without a post title,
To display text, like arrows («), at the beginning of the previous post link and at the end of the next post link so it looks like:
OK, then have a look at this one,
http://perishablepress.com/press/2006/04/23/wordpress-title-attributes/
and this one,
https://wordpress.stackexchange.com/questions/13044/how-can-i-add-title-attributes-to-next-and-previous-post-link-functions
These links has been found on google, and it exactly answers what you’re asking , so its always better to do some search before raising it as a new question.