Title: Previous_post() Question
Last modified: August 18, 2016

---

# Previous_post() Question

 *  [cordeliamars](https://wordpress.org/support/users/cordeliamars/)
 * (@cordeliamars)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/previous_post-question/)
 * I am having trouble with displaying **Previous Post **when on the **first page**
   of the blog _(there won’t be a previous post then, obviously)_ Vice versa on 
   the latest post with ‘Next Post’.
 * Right now, nothing is displayed if there is no previous/next page. This looks
   ugly, I think. (See [http://www.vikingprincess.net/24/fibroids](http://www.vikingprincess.net/24/fibroids))
 * Here is the solution that I want: When there is no previous post, I want a non-
   hyperlink in the place where the link would normally go, simply stating: “No 
   previous page available”
 * I can’t seem to produce any php that achieves this!
 * Also, it appears that if you are on the first page and ask for the previous page,**
   WP returns the name of the page you are on,** instead of an empty string or null.
   Is this right?
 * If so, does that mean that if current_title = previous_page_title , then I am
   on the first page and can display the “No previous entry” string?
 * I am not very good at php and this is really driving me crazy!
 * Please can you help to suggest a solution? Some php code or whatever the solution
   should be?
 * Hope I am making sense and that you can help!
    Here is the code I am using right
   now:
 *     ```
       <!--Populate the CommentNavigation formatted as a Table -->
       <div id="nav_styling_table">
       <table border="0" cellspacing="0" cellpadding="0">
       <tr>
       <td rowspan="2" id="arrow_deco_left" height="6%">
       <a href="<?php echo get_permalink($prev_post->ID)?>">
       <img id="arrow_deco_left_img" src="/imgs/left.gif" alt='Previous Post'></img>
       </a></td>
   
       <td id="post_previous">Previous Post:</td>
       <td id="post_next">Next Post:</td> 
   
       <td rowspan="2" id="arrow_deco_right" height="6%">
       <a href="<?php echo get_permalink($next_post->ID)?>">
       <img id="arrow_deco_right_img" src="/imgs/right.gif" alt='Next Post'></img>
       </a></td></tr>
   
       <td id="previous_post"> <?php previous_post      ('% <strong></strong> ', ''); ?></td>
       <td id="next_post"> <?php $next_title; ?></td></tr>
       </table>
       ```
   

The topic ‘Previous_post() Question’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [cordeliamars](https://wordpress.org/support/users/cordeliamars/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/previous_post-question/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
