Change Image Crop Position For Featured Images
By default, the theme generates multiple featured image sizes to use them in different locations such as widgets, blocks, mega menus, etc.
By default, the crop position is from the center if you want to change that to crop images from the top Add this code to your child theme’s functions.php
file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php
file, as this will be wiped entirely when you update the theme.
add_action( 'init', 'tie_custom_image_sizes_crop_position' ); function tie_custom_image_sizes_crop_position(){ global $_wp_additional_image_sizes; foreach ( $_wp_additional_image_sizes as $image_size => $values ){ if( strpos( $image_size, TIELABS_THEME_SLUG ) !== false ){ $_wp_additional_image_sizes[ $image_size ][crop] = array( 'center', 'top' ); } } }