1

I'm writing a child theme for Genesis and trying to figure out to get the full image sizes on "Genesis - Featured Posts" widget. The widget has a check box "Show Featured Image" and "Image Size" options of following values.

thumbnail (150x150) 
featured-image(150x100)

The options have thumbnail sizes and I'm trying to get the full size of image. Trying to write some code in functions.php of child theme which would give an option to select "full featured image".

The codes which listed second option for "Show Featured Image" on the widget is (genesis/lib/widgets/featured-post-widget.php line: 314 - 318)

<?php
$sizes = genesis_get_additional_image_sizes();
    foreach( (array) $sizes as $name => $size )
        echo '<option value="'.esc_attr( $name ).'" '.selected( $name, $instance['image_size'], FALSE ).'>'.esc_html( $name ).' ( '.$size['width'].'x'.$size['height'].' )</option>';
?>

I'm not sure if there is a way to have hook or filter for this .. If there is a way to select 'full featured image size' on the widget I'd be great.

1

If you replace genesis_get_additional_image_sizes(); with genesis_get_image_sizes() you can choose any size image for the widget thumbnail.

Replacement featured-post-widget.php is available on GitHub. And here is the replacement code:

$sizes = genesis_get_image_sizes();
                    foreach( (array) $sizes as $name => $size )
                        echo '<option value="'.esc_attr( $name ).'" '.selected( $name, $instance['image_size'], FALSE ).'>'.esc_html( $name ).' ( '.$size['width'].'x'.$size['height'].' )</option>';
0

A simple function which would add additional image size.

/*
 * add_image_size( 'post-thumbnail', $width, $height, $crop );
 * 280x254
 */

add_image_size( 'additional-image-size', 800, 600, false );

This function will add additional image size of width 800px and height 600px this function can be used in child-theme's functions.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.