Black Friday Sale! Get up to $30 off GP Premium! Learn more ➝

Reply To: Change size of page featured image

Home Forums Support Change size of page featured image Reply To: Change size of page featured image

Home Forums Support Change size of page featured image Reply To: Change size of page featured image

#98711
dmendana

Hi Tom. First, thank you for this incredibly good support for something that you provide so cheap. I have already posted a five star rating in the wp theme directory.

Of course, registering the right image size and regenerating the thumbnails is no problem.

Finally, I have done it in a slightly different way. Instead of temporarily overwriting template-tags.php, I redeclared the whole function in my child theme’s functions.php:

function generate_featured_page_header_area($class)
{
	// Don't run the function unless we're on a page it applies to
	if ( ! is_singular() )
		return;

	// Don't run the function unless we have a post thumbnail
	if ( ! has_post_thumbnail() )
		return;

	?>
	<div class="<?php echo $class; ?> grid-container grid-parent">
		<?php the_post_thumbnail( apply_filters( 'generate_page_header_default_size', 'full' ), array('itemprop' => 'image') ); ?>
	</div>
	<?php
}

And then I used the filter to replace the featured image size, but insted of using width and height, I merely put the name of the custom image size I had registered:

add_filter( 'generate_page_header_default_size', 'generate_custom_default_page_header_size' );
function generate_custom_default_page_header_size()
{
      return 'custom-image-size';
}

I tested it uploading a new featured image. Perfect! Thank you so much!