1

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 |

5

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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