• Trying to use this function to navigate between attachments. I don’t want to display the image of the next post, as the function does by default in media.php:

    function adjacent_image_link($prev = true) {
    	global $post;
    	$post = get_post($post);
    	$attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
    
    	foreach ( $attachments as $k => $attachment )
    		if ( $attachment->ID == $post->ID )
    			break;
    
    	$k = $prev ? $k - 1 : $k + 1;
    
    	if ( isset($attachments[$k]) )
    		echo wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true);
    }

    None is not a proper variable to replace thumbnail.

    This is the functionality I want, however, I don’t want an image displayed, and I want nothing to do with media.php, as that introduces the possibility of that file being overwritten in an upgrade.

    This doesn’t work:

    <a href="<?php next_image_link(); ?> "><img src="/images/attach_next.jpg" width="100" height="26" alt="next" /></a>

    There’s no permalink variable within that function to circumvent the function itself.

  • The topic ‘<?php next_image_link(); ?>’ is closed to new replies.