[Resolved] Display featured image from a particular page
I have a PAGE (News) set as my POSTS FRONT PAGE. I want the featured image (header image) I have set on this PAGE (News) to be used as the header-image used in the posts template (index.php). This will enable the client to simply change the header-image on the News page. Somehow I need to tell the header.php file to get the featured image from the news PAGE (I presume via it’s id, which is 47).
Can anyone help me out here with some code?
This is what I have in my header.php to handle the featured image in pages:
<?php // Check if this is a post or page, if it has a thumbnail, and if it's a big one if ( is_singular() && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) && $image >= HEADER_IMAGE_WIDTH ) : // Houston, we have a new header image! echo get_the_post_thumbnail( $post->ID ); elseif ( get_header_image() ) : ?> <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" class="header-img" alt="" />
- The topic ‘[Resolved] Display featured image from a particular page’ is closed to new replies.