Codex tools: Log in / create account
Contents |
This creates a link to the previous image attached to the current post.
<?php previous_image_link( [string $size = 'thumbnail'], [string $text = false] ); ?>
<?php previous_image_link(); ?>
<div class="alignleft"><?php previous_image_link() ?></div>
<?php previous_image_link( 'thumbnail' ); ?> <?php previous_image_link( 'medium' ); ?> <?php previous_image_link( 'large' ); ?> <?php previous_image_link( 'fullsize' ); ?>
<?php previous_image_link( array( 37, 37 ) ); ?>
Please note that passing an array as the first parameter will not create a new image; It will use the web browser to re-size the thumbnail to fit into the given dimensions. Although this works in a pinch, it produces a rather distorted view of the image due to the fact that browsers have no way of re sampling the re-sized image.
If a Boolean false is used as the first parameter, The function will use the image’s title value (as set through the Media Library).
<?php previous_image_link( false ); ?> <?php previous_image_link( 0 ); ?>
To specify a custom string as the link text, pass a Boolean false as the first parameter and the custom text as a string to the second parameter.
<?php previous_image_link( false, 'Previous Image' ); ?>
Since: 2.5.0
See also next_image_link()