Title: next_post_link function&#8230;
Last modified: August 19, 2016

---

# next_post_link function…

 *  Resolved [davidandre](https://wordpress.org/support/users/davidandre/)
 * (@davidandre)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/next_post_link-function/)
 * Hi everybody,
    i am really trying hard but i don t get it: i ve got this code:
   <div class=”nav-previous”>Noticia anterior:
 * <?php next_post_link(‘%link’); ?></div>
    <div class=”nav-next”>Siguiente noticia:
   <?php next_post_link(‘%link’) ?></div>
 * it works fine but i would “Noticia anterior:” to disappear if there is no previous
   post , and,”Siguiente noticia:” to disappear if there is no next post….
    I am
   completly lost .any help would be very appreciated,
 * cheers,
    david

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Victor Petrescu](https://wordpress.org/support/users/victor-petrescu/)
 * (@victor-petrescu)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/next_post_link-function/#post-1697415)
 * Try using it like this:
 * `<?php next_post_link('%link', 'Next post ', FALSE); ?>`
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/next_post_link-function/#post-1697464)
 * check the `get_adjacent_post()` function:
    [http://codex.wordpress.org/Function_Reference/get_adjacent_post](http://codex.wordpress.org/Function_Reference/get_adjacent_post)
 * try:
 *     ```
       <div class="nav-previous">
       <?php if(get_adjacent_post(false, '', true)) {  ?>
       Noticia anterior:
       <?php previous_post_link('%link'); ?>
       <?php } ?>
       </div>
       ```
   
 * and:
 *     ```
       <div class="nav-next">
       <?php if(get_adjacent_post(false, '', false)) {  ?>
       Siguiente noticia:
       <?php next_post_link('%link') ?>
       <?php } ?>
       </div>
       ```
   
 * this will leave an empty div.
 *  Thread Starter [davidandre](https://wordpress.org/support/users/davidandre/)
 * (@davidandre)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/next_post_link-function/#post-1697591)
 * Hi, victor and alchymyth
    thanks a lot. Just what i needed .Both ways works.great.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘next_post_link function…’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [davidandre](https://wordpress.org/support/users/davidandre/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/next_post_link-function/#post-1697591)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
