Resolved

modify attachment page

Ultra Theme started by bluereef Jan 5, 2018 3 replies
bluereef Jan 5, 2018 · 5:14 pm #8536

Hi Andrew,

I would like to increase the default image size on the attachment page.
Where can I do this?

Thanks for your help.

Frank

Andrew Misplon Puro Jan 5, 2018 · 5:48 pm #8538

Hi Frank

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.php file. 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 🙂

bluereef Jan 5, 2018 · 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’ ); ?>
<?php

Is it ok to do it that way?

Andrew Misplon Puro Jan 5, 2018 · 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 🙂

4 posts