• Resolved Morphim

    (@morphim)


    Hi there
    I’ve been messing around with this for ages but no joy : (
    There are a couple of similar threads here but none seem to work or properly address my problem.

    Using Twenty Thirteen theme with a child (twentythirteen-child) I’m trying to have the featured image display at the top of a post similar to a regular image thumbnail, as added to the body of a post.
    For example, when adding an image into the body of a post, it appears in it’s full proportions but at a reduced size.
    The featured image however appears at full size but cropped to 604 w x 270 h
    This gives the effect of ‘zooming’ in on the centre of my image.
    I want to display the whole image at say 500px wide by whatever the height is (this would vary depending on the featured image)

    I see this is handle by the functions.php as follows:

    add_theme_support( 'post-thumbnails' );
    	set_post_thumbnail_size( 604, 270, true );

    I’ve added this to my child functions.php & edited it and messed with the css but whatever i seem to do, nothing overides this.

    Also, on an aside (not important but … )can the featured image be clickable to a full size version. Seems featured images aren’t dynamic.

    Any ideas gratefully received.
    Thanks very much in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Morphim

    (@morphim)

    OK. I’ve worked out the cropping / resizing issue.
    It was my ignorance of php code in my child functions.php file.

    I had this as my code:

    <?php
    
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array('parent-style')
        );
    
    	/*
    	 * This theme uses a custom image size for featured images, displayed on
    	 * "standard" posts and pages.
    	 */
    
    add_theme_support( 'post-thumbnails' );
    	set_post_thumbnail_size( 600, 600 );
    }

    However, I had accidentally placed the last two lines, which control the cropping & size, outside of the last, closing {braces}
    Once moved within the last }, my function was called. Hooray : )

    Just for reference, this is the TwentyThirteen default at around line 104 of the main functions.php
    set_post_thumbnail_size( 604, 270, true );

    604 is the width, 207 is the height & true is the cropping
    So, I changed it to this in my twentythirteen-child theme functions.php

    set_post_thumbnail_size( 600, 600 );

    The 600 x 600 with the ‘true’ & preceding comma deleted, doesn’t crop & resizes to max 600px on the longest side – height for portrait & width for landscape.

    Then, the other really important thing is to regenerate your thumbnails. I used this Regenerate Thumbnails plugin.
    What this does is create new thumbnails with the new functions.php sizes above. If you don’t do this, you’ll see no change.

    I hope this helps someone.

    Just need to work out how to link to full size image now but I’ll start a new thread

    Thank you this helped! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘TwentyThirteen – stop Featured Image from cropping’ is closed to new replies.