- January 5, 2018 at 5:14 pm #8536
I would like to increase the default image size on the attachment page.
Where can I do this?
Thanks for your help.
FrankJanuary 5, 2018 at 5:48 pm #8538
This snippet works for me: https://gist.github.com/rfmeier/5753101.
If you have a child theme you can insert that snippet minus the opening PHP tag into your child
functions.phpfile. If not, go to
Plugins > Add New, search for and install Code Snippets. Then go to
Snippets > Add New, name the snippet as you’d like and insert the code from the Gist link above into the snippet body. Do not insert the opening PHP tag
<?php. Finally, opt to run the snippet on the site front-end only and then click Save changes and active. Note that it’s possible to only save a snippet so you must save and activate.
Let me know how that goes 🙂January 5, 2018 at 7:19 pm #8539
Yes. That works. Thanks!
I was also able to do it by creating an attachment.php file in my child theme, copying the single.php code and modifying it by adding:
<?php echo wp_get_attachment_image( get_the_ID(), ‘large’ ); ?>
Is it ok to do it that way?January 5, 2018 at 7:21 pm #8542
100%. I wasn’t sure if you were using a child theme so I was going for easiest method. With a child theme it’s super easy to add an attachment.php file and take control that way. Nicely done and thanks for the update 🙂
You must be logged in to reply to this topic.