Removing header images from posts
-
Hi,
I do not want to have the featured image for a post to be shown on the post itself as a header. Can I remove the header image from posts?
Thanks
-
Hi yv3333, remove this code from ‘content-single.php’
(backup the file before you start editing it)
<?php } else if ($headcontent == ‘image’) { ?>
<?php global $post; $height = get_post_meta( $post->ID, ‘_kad_posthead_height’, true ); if ($height != ”) $slideheight = $height; else $slideheight = 350;
$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url( $thumb,’full’ ); //get full URL to image (use “large” or “medium” if the images too big)
$image = aq_resize( $img_url, $slidewidth, $slideheight, true ); //resize & crop the image
if(empty($image)) { $image = $img_url; }
?>
<?php if($image) : ?>
<div class=”imghoverclass post-single-img”>” rel=”lightbox[pp_gal]” class=”lightboxhover”><img src=”<?php echo $image ?>” alt=”<?php the_title(); ?>” /></div>
<?php endif; ?>Please note: this will not display the image in single post but will display image gallery, video etc. If you would like the others to not show let me know and I will post the code to remove.
Hope this helps
Hi yv3333, remove this code from ‘content-single.php’
(backup the file before you start editing it)
<?php } else if ($headcontent == 'image') { ?> <?php global $post; $height = get_post_meta( $post->ID, '_kad_posthead_height', true ); if ($height != '') $slideheight = $height; else $slideheight = 350; $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url( $thumb,'full' ); //get full URL to image (use "large" or "medium" if the images too big) $image = aq_resize( $img_url, $slidewidth, $slideheight, true ); //resize & crop the image if(empty($image)) { $image = $img_url; } ?> <?php if($image) : ?> <div class="imghoverclass post-single-img"><a href="<?php echo $img_url ?>" rel="lightbox[pp_gal]" class="lightboxhover"><img src="<?php echo $image ?>" alt="<?php the_title(); ?>" /></a></div> <?php endif; ?>
Please note: this will not display the image in single post but will display image gallery, video etc. If you would like the others to not show let me know and I will post the code to remove.
Hope this helps
Hi,
Thanks for the reply. I am trying to remove header images from the content-singleportfolio.php file and the code seems to be different. Could you please tell me if there is an equivalent code to remove there?
I am working around the issue now by specifying image width and height as 1 px in the port-folio item posts.Thanks
Hey,
Just set your post head content to none.
http://docs.kadencethemes.com/virtue/#blog_postsKadence Themes
Thank you, that was easy!
I’m not sure if this is the same question because I’m interested in removing an image from pages rather than a posts. I have a picture of a rose on my home page. . . rather like a banner at the top. It was first established in twenty ten and I migrated it to Virtue. Problem is, it also appears at the top of every page and I don’t want that. I can’t find how to get rid of it on internal pages. Help!
- The topic ‘Removing header images from posts’ is closed to new replies.