Reputation: 927
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
Upvotes: 1
Views: 562
Reputation: 18753
OK, then have a look at this one,
http://perishablepress.com/press/2006/04/23/wordpress-title-attributes/
and this one,
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.
Upvotes: 0
Reputation: 18753
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,
<?php previous_post(); ?>
it displays text "previous post:" as link along with post title.
without a post title,
<?php previous_post('%','« Previous', 'no'); ?>
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:
<?php previous_post('« « %', '', 'yes'); ?>
| <?php next_post('% » » ', '', 'yes'); ?>
Upvotes: 1