Image position and size on Homepage

Stargazer 3 posts 2 voices

  1. Hi,

    I’m trying to create a child theme based on startgazer, I noticed that on the homepage Featured images of articles, are sometimes positioned above, sometime on the right. Is there a way to force the position of the image? Is there also a way to force the image size?

    Thanks

  2. The position of the image is based on the orientation. If you add a portrait-oriented image, it’ll be positioned to the right. If you add a landscape-oriented image, it’ll be positioned to the left.

    The image can be forced to be positioned a certain way. Just need to know which you prefer.

    The image size can also be hard cropped. Adding the following code to your child theme’s functions.php will hard crop the images. It’d also orient them landscape, so they should always be above the title by doing this.

    add_action( 'init', 'th_register_image_sizes' );
    
    function th_register_image_sizes() {
    
    	add_image_size( 'stargazer-full', 1025, 500, true );
    }

    Of course, you’d want to have images that are at least 1025 x 500. You can change those values though to something that suits you better.

    This change will only affect new images that are uploaded. You can regenerate old image sizes with the Regenerate Thumbnails plugin: https://wordpress.org/plugins/regenerate-thumbnails/

  3. The position of the image is based on the orientation. If you add a portrait-oriented image, it’ll be positioned to the right. If you add a landscape-oriented image, it’ll be positioned to the left.

    The image can be forced to be positioned a certain way. Just need to know which you prefer.

    The image size can also be hard cropped. Adding the following code to your child theme’s functions.php will hard crop the images. It’d also orient them landscape, so they should always be above the title by doing this.

    add_action( 'init', 'th_register_image_sizes' );
    
    function th_register_image_sizes() {
    
    	add_image_size( 'stargazer-full', 1025, 500, true );
    }

    Of course, you’d want to have images that are at least 1025 x 500. You can change those values though to something that suits you better.

    This change will only affect new images that are uploaded. You can regenerate old image sizes with the Regenerate Thumbnails plugin: https://wordpress.org/plugins/regenerate-thumbnails/