Because the title states, i'd like a pleasant little bit of coding to stay during my functions that pre-loads any images that are affixed to the following publish.

Which means that although my customers are browsing, they page will load, however it will really be loading the following page, then when clicking-through, the pictures should be there and waiting!

Think about it as being 'buffering' for image.

Anybody got any ideas about this?


So that your customer is on-page produced by single.php. You have to place your js inside. You must do it within the loop because that's only place in which you have publish id to utilize. There's just one problem, what's your next publish? Publish which was published before current or after current? If customer is certainly going backwards you have to load images from publish published before current. Anyway that you can do something similar to this (supposing you have jquery loaded).

NOTE: you need to put this informed!

removed old code

Paperwork for get_adjacent_publish() are here, you are able to set publish to stay in same category, and you will exclude groups.

UPDATE: I made some funny typos here is nice code, examined on my small installing of wordpress, works together with custom publish types:

    $next_post = get_adjacent_post(false, '', false );// set last param to true if you want post that is chronologically previous
    //for debug
       echo 'Next post title is: '.$next_post->post_title;
    } else {
        echo 'global $post is not set or no corresponding post exists';
    $args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_parent' => $next_post->ID);
    $attachments = get_posts($args);
    // print attachments for debug
    echo '<pre>';print_r($attachments);echo '</pre>';
<script type="text/javascript">
        var images = '';
        <?php foreach($attachments as $attachment):
            $mime = $attachment->post_mime_type;
            if($mime == 'image/jpeg' || $mime == 'image/gif' || $mime == 'image/png'): 
        images += '<img src="<?php echo $attachment->guid ?>" style="display:none" />';
        <? endif; endforeach; ?>
        if(images != ''){