[Resolved] modify attachment page

This topic contains 3 replies, has 2 voices, and was last updated by  Andrew Misplon 7 months, 1 week ago.

  • Author
    Posts
  • #8536

    bluereef
    Participant

    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

    #8538

    Andrew Misplon
    Keymaster

    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 🙂

    #8539

    bluereef
    Participant

    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?

    #8542

    Andrew Misplon
    Keymaster

    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 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Scroll to top