Images in the Twenty Fourteen theme

How and were do I change the size on the sticky post images and the other images in the theme twentyfourteen?

I would like 8 sticky post images on the “front page” instead of 6 and I want them in a more portrait format so that I can use all my old images on my current blog (600x850px). I like the theme but all my old images are not suitable for the format.

Read More

I really can’t find the sizes anywhere.

Related posts

3 comments

  1. Well, that was… interesting. In a nutshell there seem to be two things in play here:

    • max_posts set to 6 in add_theme_support( 'featured-content'
    • quantity set to default 6 in Featured_Content class

    quantity defines how many posts there are, but can be no larger than max_posts. However while result can be pushed down by changing max_posts it cannot be pushed up since there doesn’t seem to be clean way provided for changing quantity. If I read code accurately it was either meant to be input in Customizer or was there and got removed.

    So to change both, this is closest to sane I could come up with on Sunday evening:

    add_action(
            'after_setup_theme',
            function () {
                add_theme_support(
                        'featured-content',
                        array(
                                'featured_content_filter' => 'twentyfourteen_get_featured_posts',
                                'max_posts'               => 8,
                        )
                );
            },
            11
    );
    
    add_filter(
            'option_featured-content',
            function ( $array ) {
                if ( ! empty( $array ) && is_array( $array ) ) {
                    $array['quantity'] = 8;
                }
    
                return $array;
            }
    );
    

    Note that posts set is cached in transient, so need to re-save it with Customizer for new count to apply.

    As for size – thumbnail size is used for grid version of it, see content-featured-post.php.

  2. The two image sizes are defined in the theme’s functions.php file:

    set_post_thumbnail_size( 672, 372, true );
    add_image_size( 'twentyfourteen-full-width', 1038, 576, true );
    
  3. Add your own custom sizes or modify the values for the existing sizes.

    You can use this code which includes a parameter to hard crop your images in different positions:

    add_image_size( 'custom-size', 220, 220, array( 'left', 'top' ) ); // Hard crop left top
    

Comments are closed.