Featured Images
-
Hello everyone,
I am finishing up our site and have ran into a snag. I have a featured image script for pages and so on. I have the blog page connected, but when I create a new post, the featured image on that post goes into my featured image header which I don’t want it to do. So basically I want to have a featured image header for my pages which works, but also for my blog page without the featured image for the post showing up. Below you will find the URL of the page and also my code.
http://gracechurch.wsoa.biz/
http://gracechurch.wsoa.biz/blog/<?php if(has_post_thumbnail() && !is_single()) { (int) $thumb_id = get_post_thumbnail_id(); $thumb_details = wp_get_attachment_image_src( $thumb_id, 'full' ); } elseif(is_home() || is_single()) { $page_for_posts = get_option('page_for_posts'); global $wp_query; if ($wp_query->is_posts_page && has_post_thumbnail( $page_for_posts )) { $thumb_details = wp_get_attachment_image_src( $page_for_posts, 'full' ); } else { $thumb_details = NULL; } } else { if(!empty($post->ancestors)) { (int) $ancestor_id = end($post->ancestors); $thumb_id = get_post_thumbnail_id($ancestor_id); if(empty($thumb_id)) { $thumb_details = NULL; } else { $thumb_details = wp_get_attachment_image_src( $thumb_id, 'full' ); } } else { $thumb_details = NULL; } } $thumb_path = (!empty($thumb_details) ? $thumb_details[0]: '/wp-content/themes/grace-church-2013/images/inside-banner.png'); $splashInterior = "width: 1600px; height: 337px; background: url(" .$thumb_path . ") no-repeat;"; ?><!-- end of Jessica's script --> <div id="inside-banner" style="<?php echo $splashInterior; ?>"></div> <?php }?> </div>
The topic ‘Featured Images’ is closed to new replies.