Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can I make the arrow as part of the link please?

<?php next_post_link('%link &rarr;'); ?>

The output of above will be | <a href="nextPostLink">NextPostTitle<a> arrow |

share|improve this question
add comment

1 Answer

As the documentation for next_post_link states, the link parameter is where the actual text of the %link placeholder goes. The format parameter is the whole text, where %link is unpacked from the second link parameter. Solution:

next_post_link( '%link', '%title &rarr;' );

Expected output: <a href="...">Title &rarr;</a>

Something like this, on the other hand:

next_post_link( 'Over to %link now!', '-- %title --' );

...will result in: Over to <a href="...">--- Title ---</a> now!

See how these are unpacked?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.