Adding secondary featured image for page_for_posts
@Howdy_McGee helped me sort out adding a banner image to page_for_posts, however I need to resize images showing up in the blogroll for page_for_posts so it doesn't use the featured image banner because it's too wide. Codex states I use ?php add_image_size( $name, $width, $height, $crop ); ?
to resize an image specifically for this. However I'm not a php expert hoping someone could help point me in the right direction on how/where to add this. Here's my current code below. Thanks!
//* Add Header Images on Posts/Pages
add_image_size( 'header-img', 1600 );
add_action( 'genesis_after_header', 'site_banner', 0 );
function site_banner() {
if( ( is_page() || is_home() || is_single() ) ) {
$post_id = ( is_home() ? get_option( 'page_for_posts' ) : get_the_ID() );
if( has_post_thumbnail( $post_id ) ) {
$ftbanner = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'header-img' );
$banner = $ftbanner[0];
echo 'div id="site-banner" class="site-banner"' . "\n";
echo 'img src="' . $banner . '"' . "\n";
echo '/div' . "\n";
}
}
}
Topic blogroll page-template images Wordpress
Category Web