• Hi all,

    I’m a newbie here trying to setup a new Hueman site. I have a child theme going and trying to change the file sizes of Thumbnails that get generated (most importantly, I want to change aspect ratio for Featured images, which I believe is being controlled by ‘thumb-large’).

    When I try to add adjusted code to the functions.php of the child theme it either doesn’t work at all or breaks the site. I think I need some basic guidance on how to properly format the code, unless there is some other reason it’s not working.

    Here are the thumbnail sizes I would like to have:

    //
    add_image_size( ‘thumb-small’, 160, 160, true );
    add_image_size( ‘thumb-medium’, 520, 347, true );
    add_image_size( ‘thumb-large’, 720, 480, true );
    //

    In the main Hueman theme, the thumbnails are listed in this section:

    //
    if ( ! function_exists( ‘alx_setup’ ) ) {

    function alx_setup() {
    //

    If you can show me how to properly put this in the child theme function.php that would be great.

    Thanks!
    Mike

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

    (@kahncious)

    OK, I have hacked at it and read some more. I have solved the issue by putting the entire function and all its variables in the child theme’s functions.php file. I had assumed that I could just put in some variables and not others but that does not appear to be the case. I would love to get confirmation on that before I mark this as resolved. Thanks!

    This is everything that I have put in the child functions file (only the medium and large thumbnail sizes were changed):

    function alx_setup() {
    		// Enable automatic feed links
    		add_theme_support( 'automatic-feed-links' );
    
    		// Enable featured image
    		add_theme_support( 'post-thumbnails' );
    
    		// Enable post format support
    		add_theme_support( 'post-formats', array( 'audio', 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) );
    
    		// Declare WooCommerce support
    		add_theme_support( 'woocommerce' );
    
    		// Thumbnail sizes
    		add_image_size( 'thumb-small', 160, 160, true );
    		add_image_size( 'thumb-medium', 520, 347, true );
    		add_image_size( 'thumb-large', 720, 480, true );
    
    		// Custom menu areas
    		register_nav_menus( array(
    			'topbar' => 'Topbar',
    			'header' => 'Header',
    			'footer' => 'Footer',
    		) );
    	}

    There are so many good questions about featured images and thumbnails, but I never see any good answers that work for me. I’d love to see some well written details on how to do this. I think the Hueman theme is great but I’m trying to get the Featured Images to be the right size for my site and they need to be portrait, about 400w x 500h. Whenever I try any of these instructions for modifying the Thumbnail sizes code, it never works — it just stretches out the images way too big.

    All I really want is to have the Featured Image show up in the sidebar (smallish thumbnail, just like with AxlPosts widget), and maybe not at all in post, since I can easily insert image into post. But when I use Featured Image after I’ve inserted my image into the post, of course, then I have 2 images, and I only want 1. But I don’t know of any other way to get the thumbnail in the sidebar, other than the AxlPosts widget, which is easy to use. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Update child theme's function.php for image Thumbnail Sizes’ is closed to new replies.