set image size on attachment page

Community Forums Forums Design Tips and Tricks set image size on attachment page

This topic is: not resolved

This topic contains 6 replies, has 4 voices, and was last updated by  rfmeier 1 year, 10 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #45130


    I’d like to use a different image size on the attachment page – it looks like WP/Genesis is taking the medium image – how can I do that?





    Good question. I had to dig around WordPress to find out exactly where this was being specified. You can adjust this with the WordPress ” filter. Hereis what I came up with;

    I hope this helps.



    Thank you! I tried it and it works perfectly!

    This problem has been driving me nuts for ages – finally took the time to search for an answer. I’m off to paste this into a bunch of sites! Thank you so much!


    Bart van Maanen

    This looks like the fix I’m looking for. However, I pasted into the bottom of functions.php of the Minimum Pro theme and it disabled the whole file. Do I need to create a seperate attachment.php file to add to the Child Theme?

    Or is it something with the //* -tags

    I’m trying to use it in conjuction withe these styling options for the attachment pages:

    //* Customize the post info function
    add_filter( 'genesis_post_info', 'sp_post_info_filter' );
    function sp_post_info_filter($post_info) {
    if ( !is_attachment() ) {
    	$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
    	return $post_info;
    //* Customize the post meta function
    add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
    function sp_post_meta_filter($post_meta) {
    if ( !is_attachment() ) {
    	$post_meta = '[post_categories before="Filed Under: "] [post_tags before="Tagged: "]';
    	return $post_meta;


    Change //* to just //

    The //* is expecting a */ closure.


    Bart van Maanen

    I had to comment out the following, and then it worked;

    add_filter( 'prepend_attachment', 'custom_prepend_attachment' );
    // * Callback for WordPress 'prepend_attachment' filter.
    // * 
    // * Change the attachment page image size to 'full'
    // * 
    // * @package WordPress
    // * @category Attachment
    // * @see wp-includes/post-template.php
    // * 
    // * @param string $attachment_content the attachment html
    // * @return string $attachment_content the attachment html
    function custom_prepend_attachment( $attachment_content ){
            // set the attachment image size to 'full'
            $attachment_content = sprintf( '<p>%s</p>', wp_get_attachment_link(0, 'full', false) );
            // return the attachment content
            return $attachment_content;

    Is that okay?
    Can I also add some code here to prevent the image to link any further. See:





    It will not hurt anything. Good luck.

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

You must be logged in to reply to this topic.