At BusinessLogs, we help you communicate better with your customers by designing elegant, friendly application interfaces & blogs. Learn More ›

Genesis Tip: Change Image Size on Attachment Pages

Genesis has a bunch of custom filters and hooks for manipulating the layout and content of your custom WordPress site, but sometimes finding the right one isn’t so easy to do. In this case, I was trying to change the default image size on attachment pages.

Turns out the answer lies not in poking around the Genesis code but WordPress itself. The prepend_attachment function has a filter that will let you modify how the attachment image—including its wrapper paragraph—is displayed. So all you have to do is add a filter that modifies the image size, like so:

add_filter('prepend_attachment', 'ag_prepend_attachment');
function ag_prepend_attachment($p) {
    return '<p class="attachment">'.wp_get_attachment_link(0, 'large', false).'</p>';
}

Drop this in your functions.php file and you’re set. Since this is a WordPress filter, this tip should also apply to other WordPress themes.

About Sophia Lucero

A designer by profession, Sophia has extensive experience in managing both the technical and design aspects of blogs. If she had her way, the Internet would have nothing but beautifully-designed, compliant sites.

Comments

  1. Web Design says:

    Great script. Thanks for sharing!

  2. Ari Wahyudi says:

    I spent hours looking for this tips. THANK YOU.

  3. Ari Wahyudi says:

    I hope you can help me out once more,

    Attachment page in genesis framework don’t have navigation (Previous image/Next image).

    Do you have any tips on how to add it? I will appreciate it much. Thank you.

Speak Your Mind

*