Attachment page image size
Beautiful and responsive WordPress theme with amazing parallax effect.
- GK User
- Tue Nov 08, 2016 3:53 pm
Can anyone give me a hand with changing the size of the image displayed on the attachment page (the page that displays when you click a gallery thumbnail and you have 'Link to attachment page' in the gallery settings.
I know I need to edit wp-content/themes/Creativity/attachment.php and I can guess it's the code shown below.
I just need to know how to edit this to have the large, rather than the full size image displayed.
Thanks in advance.
Ken
I know I need to edit wp-content/themes/Creativity/attachment.php and I can guess it's the code shown below.
- Code: Select all
<p>
<a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment">
<?php echo wp_get_attachment_image( $post->ID, array( 900, 9999 ) ); ?>
</a>
</p>
I just need to know how to edit this to have the large, rather than the full size image displayed.
Thanks in advance.
Ken
-
- Expert Boarder
- Joshua M
- Wed Nov 09, 2016 9:38 am
Hi,
Please change the following line (from your fragment):
to:
You can also use other image sizes like "large", "medium" etc.
https://codex.wordpress.org/Post_Thumbnails
Please change the following line (from your fragment):
- Code: Select all
<?php echo wp_get_attachment_image( $post->ID, array( 900, 9999 ) ); ?>
to:
- Code: Select all
<?php echo wp_get_attachment_image( $post->ID, 'thumbnail' ); ?>
You can also use other image sizes like "large", "medium" etc.
https://codex.wordpress.org/Post_Thumbnails
-
- Moderator
- GK User
- Wed Nov 09, 2016 10:42 am
Perfect! Thanks!
-
- Expert Boarder
3 posts
• Page 1 of 1