0

Here's an interesting question. I am trying to format previous and next links using the following format

   <?php previous_post_link('<strong>«</strong>'); ?>
   <?php next_post_link('<strong>»</strong>'); ?> 

I did this on purpose to not display the post title and make users need to click the arrows in to move on the previous and next post. However, this does not create a link around the arrows and I was wondering if there's a way to accomplish this.

Thanks

Johann

1

See the codex. The first parameter is format, the second is link text.

 <?php previous_post_link('<strong>%link</strong>', '&laquo;'); ?>
   <?php next_post_link('<strong>%link</strong>', '&raquo;'); ?> 
  • There is a typo: > missing in both link formats, after <strong, I cannot edit just 2 chars. @vancoder. – gmazzap Aug 21 '13 at 19:02
  • Hi @vancoder, thanks for your code. It worked as a guide (solution is posted down below). – Johann Aug 21 '13 at 19:14
0

At the end, I ended up using:

 <?php next_post_link( '%link', '<div class="next-link"> «</div>', false ); ?>
 <?php previous_post_link( '%link', '<div class="previous-link"> »</div>', false ); ?>

Which exactly renders the previous and next arrows as links.

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.