• I have trawled the Codex to see if there is an easy way to check for the oldest post, but can find nothing at all. I want to navigate through images using Next/Previous, and it would be useful to know when the next Previous post is the oldest (the last in the list so to speak). Is there a function, or an easy way, to check for the oldest post, i.e. the first post ever posted?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The oldest post should be the one with the lowest post id. What query are you using to grab all of these images for display?

    Thread Starter bondbloke

    (@bondbloke)

    I hadn’t got that far quite yet. What I am doing is creating a photoblog theme with Next\Previous links and picking up the url of the full size image to read the exif data; however when it comes to the oldest post the url is not being picked up. Therefore I thought that if there were an easy way of checking for the oldest post this may aid me to get the required url for the image in that particular post.

    This is the relevant piece of code:-

    $size = "full";
    
       $photos = get_children( array(
        'post_parent' => $post->ID,
        'post_status' => 'inherit',
        'post_type' => 'attachment',
        'post_mime_type' => 'image',
        'order' => 'ASC',
        'orderby' => 'menu_order ID') );
    
    	   	if ($photos) {
    	  	$photo = array_shift($photos);
    		$result = wp_get_attachment_url($photo->ID, $size);
      	}
    
    $imgurl = $result;
    
    $exif = exif_read_data($imgurl, 'EXIF');

    but for some reason when I get to the oldest post $photos is empty.

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

The topic ‘Check for oldest post…’ is closed to new replies.