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.