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.

Speak Your Mind