Title: &#8216;same day&#8217; navigation link on single.php?
Last modified: August 19, 2016

---

# ‘same day’ navigation link on single.php?

 *  [Anointed](https://wordpress.org/support/users/anointed/)
 * (@anointed)
 * [16 years ago](https://wordpress.org/support/topic/same-day/)
 * I am trying to modify my ‘previous’ navigation link to use in another spot on
   my single.php page to show articles from ‘same day’
 *     ```
       function get_prev_post_by_sermon($link="&laquo; %link", $title="%title") {
               global $wpdb, $post;
               $prev = $wpdb->get_row($wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type='xyz' AND post_status='publish' AND post_date < '".$post->post_date."' ORDER BY post_date DESC LIMIT 1;"));
               if($prev) {
                       $title = preg_replace('/%title/',$prev->post_title, $title);
                       echo preg_replace('/%link/', '<a href="'.get_permalink($prev->ID).'" rel="prev">'.$title.'</a>', $link);
               }
       }
       ```
   
 * No matter what I try to add to the post_date portion, I can’t seem to come up
   with a parameter to return values for the same day.
 * Is there a wp function for this?

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

 *  Thread Starter [Anointed](https://wordpress.org/support/users/anointed/)
 * (@anointed)
 * [16 years ago](https://wordpress.org/support/topic/same-day/#post-1511068)
 * to be clear…
 * I will create a new function using above code as example, to place a 3rd link
   on the single page called ‘same day’.
 *  Thread Starter [Anointed](https://wordpress.org/support/users/anointed/)
 * (@anointed)
 * [16 years ago](https://wordpress.org/support/topic/same-day/#post-1511285)
 * bumping. Hoping someone can chime in on how to pull articles from same date. 
   Looked through codex, but no luck so far

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

The topic ‘‘same day’ navigation link on single.php?’ is closed to new replies.

 * 2 replies
 * 1 participant
 * Last reply from: [Anointed](https://wordpress.org/support/users/anointed/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/same-day/#post-1511285)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
