Featured image
-
I have continually found this a problem and no clean, simple answers.
For my site, I want all of my standard pages to display the featured image full width at the top of the page.I have added the below code to my functions.php file:
if ( function_exists( ‘add_theme_support’ ) ) {
add_theme_support( ‘band-top’ );
set_post_thumbnail_size( 1000, 300, array( ‘center’, ‘top’ ) );
}I then regenerated my thumbnails and on my page.php I have inserted the below where the image is to appear:
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail(‘band-top’);
}In my CSS, to keep it responsive:
#content-area img {
width: 100%;
}My problem is the height of my image. I want it to be 300px high without distorting the image so all featured images will appear the same size and be cropped from the top.
Any help would be great!
The topic ‘Featured image’ is closed to new replies.