azazu testing
azazu testing

Reputation: 91

WordPress How to output next post and previous post with custom name?

I am using twenty twelve theme ,and i am trying to output Next post and Previous Post at the bottom of inner page.

The thing is this function outputs the post title and 2 arrows like this : Remaining essentially unchanged »

        <?php next_post_link(); ?>

What I am trying to achieve is to have only < Previous Post - Next Post >.

Can anyone help me out with this one ?

Thank you.

Upvotes: 0

Views: 706

Answers (2)

Stephen Punwasi
Stephen Punwasi

Reputation: 476

You can customize the link text by passing it as the second parameter.

<?php next_post_link( '%link', 'Link Text Here' ); ?>

So in your case, your next link would be

<?php next_post_link( '%link', 'Next Post >' ); ?>

You can do the same with prev_post_link().

Further reading: https://codex.wordpress.org/Function_Reference/next_post_link

Upvotes: 1

Ohgodwhy
Ohgodwhy

Reputation: 50787

You can add a formater and link text arguments to your code.

previous_post_link( '< %link', 'Previous Post');
next_post_link( '%link >', 'Next Post');

Something like that should work for you.

Upvotes: 1

Related Questions