Support » Theme: Hatch » [Theme: Hatch] change the size of the first image in a post

Viewing 9 replies - 1 through 9 (of 9 total)
  • If you want to remove template size of any image/first iage, remove this line from post.php

    <?php hybrid_entry_class(); ?>

    You can then set size of image in each post individually via HTML view.

    Thank you so much ! I’ll try it right now.

    Well, i just tried it & to be honest, this doesn’t work very well with this theme. I only wish i can change the first image’s size… But thanks again anyway.

    @ojabierto

    you want to change the size of header image.

    According your theme the header image is fixed in style.css template. you can edit here the width header-banner:

    #header-banner {
    	width: 68.08510638297872%; <--edit the image
    	float: right;
    }

    and edit the custom-width of image in function.php template of your theme.

    $args = array(
    		'width'         => 630, <-- edit the width
    		'height'        => 360,
    		'header-text'   => false,
    		'default-image' => trailingslashit( get_stylesheet_directory_uri() ).'images/header_default.png',
    		'uploads'       => true,
    	);
    	add_theme_support( 'custom-header', $args );

    Hi,
    This is what I did to control the size of the featured image in hatch:
    First of all, I hear it’s bad to alter the theme code, so make sure you have a pristine copy of hatch and create a child theme. This is very easy. My child theme consists of a folder (in the themes folder) called hatch-child. Into hatch child I put a style.css file with:

    /*
    Theme Name: Hatch Child
    Description: Child theme for Hatch theme
    Author: stoatoffear
    Template: hatch
    */
    
    @import url("../hatch/style.css");

    Please bear in mind that the theme name “hatch” is case-sensitive.
    Next create a functions.php file in the hatch-child folder with the following, but altering the line at the bottom as you wish:

    <?php
    
    /**
    * @package Hatch Child
    * @subpackage Functions
    * @version 0.1
    * @author DevPress
    * @link http://devpress.com
    * @license http://www.gnu.org/licenses/gpl-2.0.html
    */
    
    /* Do theme setup on the 'after_setup_theme' hook. */
    add_action( 'after_setup_theme', 'hatch_child_theme_setup', 11 );
    
    function hatch_child_theme_setup() {
    
        /* Get action/filter hook prefix. */
        $prefix = hybrid_get_prefix();
    
        /* Custom image sizes */
        remove_action( 'init', 'hatch_image_sizes' );
        add_action( 'init', 'mytheme_image_sizes' );
    
    }
    
    function mytheme_image_sizes() {
    
    	add_image_size( 'single-thumbnail', 640, 360, true );
    /*alter this line to change the featured image size
    delete "true" to stop the image being cropped, or change the width and height. */
    }
    ?>

    Then activate the child theme in your site and voila! You will have to re-insert any images that were inserted before you activated the child-theme, plus the header image on the home page will also need to be re-done, and if you have a menu you will have to reactivate it.

    Check my site http://www.richardcalvert.com where you can see that the featured images are now not cropped, and insert themselves at the correct height – whatever that is.

    I am a newbie too, so be sure to point out any improvements! I haven’t noticed any problems yet though.

    Hi Richard,

    Thank you for share your experience here. Your technic sounds very interesting to me. But to be honest, i don’t want to re-insert so many images. 😉 (as you can see http://ojabierto.net/)

    So i think i’ll keep my website with these cropped featured images.

    Anyway, i hope that your advice will help some people.

    Bye.

    ojabierto, you’d only have to reinsert your featured images, plus the main image on your home page.

    I have learned a lot from the discussions. I will definitely benefited from the ideas

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Theme: Hatch] change the size of the first image in a post’ is closed to new replies.