• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

set image size on attachment page

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

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

This topic is: not resolved

Tagged: attachment pages, images, thumbnails

  • This topic has 6 replies, 4 voices, and was last updated 9 years, 10 months ago by rfmeier.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • June 10, 2013 at 4:20 pm #45130
    mmjaeger
    Member

    Hello
    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?

    Thanks

    June 10, 2013 at 4:44 pm #45133
    rfmeier
    Member

    Hello,

    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.


    Ryan Meier – Twitter

    December 16, 2013 at 4:23 pm #79566
    Cleo3
    Participant

    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!

    January 22, 2014 at 3:05 pm #86540
    Bart van Maanen
    Participant

    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;
    }}
    January 22, 2014 at 5:44 pm #86559
    rfmeier
    Member

    Change //* to just //

    The //* is expecting a */ closure.


    Ryan Meier – Twitter

    January 23, 2014 at 12:39 pm #86669
    Bart van Maanen
    Participant

    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: http://www.thomaselshuis.nl/wpsite/portfolio/travelogue/attachment/gr-twilight-horizon/

    Thanks!

    January 23, 2014 at 4:12 pm #86701
    rfmeier
    Member

    Bart,

    It will not hurt anything. Good luck.


    Ryan Meier – Twitter

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble