• Tanya

    (@gazette-gal)


    I can’t seem to stop the feature images from replacing the header image on single post pages.

    I have created a child-theme and have followed the instructions in both of these threads and the feature image is still displaying as the header on the single post pages.
    https://www.ads-software.com/support/topic/setting-featured-image-changes-the-post-header/

    https://www.ads-software.com/support/topic/making-the-header-stay-put-on-blog-posts/

    Currently, the header.php file in my child-theme is saved with this code:

    <?php // Let's show a header image if we aren't on the front page and a header has been set
    		if ( ! pique_is_frontpage() AND get_header_image() ) : ?>
    			<a class="pique-header" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
    
    			<?php // If the post uses a Featured Image, let's show that
    			if ( is_singular() && has_post_thumbnail() ) :
    				
    			?>
    				<img id="pique-header-image" src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php bloginfo( 'name' ); ?>">
    			<?php endif; // End featured image check. ?>
    			</a>
    		<?php endif; // End header image check. ?>

    The blog page here displays the correct header and the feature image as the background (which I want):
    https://panopticnews.com/foundations/blog/

    The single post page here displays the feature image as the header which I don’t want:
    https://panopticnews.com/foundations/need-a-google-account/

    Are you able to tell me what I’m doing wrong? Thank you. Tanya

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Tanya

    (@gazette-gal)

    I’ve decided on a work around so when you click on those two pages at first glance they seem like they have the same header… but if you watch closely the logo seems to shift ever so slightly on the second page. So the above still isn’t working, I just managed to make it sort of look like it is.

    Siobhan

    (@siobhyb)

    Hi Tanya,

    The second link you gave (https://panopticnews.com/foundations/need-a-google-account/) is currently leading to a 404 page.

    Could you please provide me with the updated link? It’d also be useful to hear more details on the workaround that you implemented: Was it a CSS workaround or did you make changes to the theme’s code?

    I’ll help out from there.

    Thanks!

    Thread Starter Tanya

    (@gazette-gal)

    Oh sorry about that, I took the post down. The work around that I’ve done isn’t anything fancy, no css or coding… I’ve just decided that I’ll simply use the header image as the feature image for every other post. This way, on my blog page it will alternate with a solid colour and the same image and then the header image doesn’t change on any of the posts either. The code provided definitely didn’t work, and if I apply a unique feature image to a post the header image still changes. But I’m just not going to apply unique feature images. For the way I work with the site and sharing it’s not a big deal as I custom set the share images through CoSchedule anyway. I’ve got a pretty full plate right now, but I do have another sub-site that I could replicate the issue in on the weekend if you wanted to investigate the issue.

    I was wondering if perhaps the fact that I’m in a multi-network setup might be part of the issue?

    Thanks,
    Tanya

    Siobhan

    (@siobhyb)

    Hi Tanya,

    Are you trying to remove the featured image from single posts or the posts page?

    If you’re trying to remove them from single posts only then try removing the following if statement from the child theme’s header.php file:

    <?php // If the post uses a Featured Image, let's show that
    if ( is_singular() && has_post_thumbnail() ) :
    	the_post_thumbnail( 'pique-header', array( 'id' => 'pique-header-image' ) );
    else : // Otherwise, let's just show the header image
    ?>

    Also removing the closing part of the if statement:

    <?php endif; // End featured image check. ?>

    The above will remove featured images from single posts but not from the main posts page.

    Thread Starter Tanya

    (@gazette-gal)

    Yes I’m only trying to stop the featured image from replacing the header image on single posts.

    But nope, that didn’t work either unfortunately. Below is what the code in the header.php looks like in my child theme after applying your changes above.

    		<?php // Let's show a header image if we aren't on the front page and a header has been set
    		if ( ! pique_is_frontpage() AND get_header_image() ) : ?>
    			<a class="pique-header" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
    
    				<img id="pique-header-image" src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php bloginfo( 'name' ); ?>">
    
    			</a>
    		<?php endif; // End header image check. ?>
    Thread Starter Tanya

    (@gazette-gal)

    Here’s a screenshot from my file manager – I’m working with a multi-site network setup. Do I have the child theme folder in the right location?

    Screenshot of file manager

    Siobhan

    (@siobhyb)

    Hi @gazette-gal,

    Apologies for the delay in reply here! I was away last week.

    The code you gave in your last reply and the location of your child theme looks correct.

    I took a look over a few individual posts on your site and they appear to be displaying the site’s header image rather than the featured image:

    Is the code working correctly for you now? If not, can you please provide me with a direct link to a page/post where I can see a featured image being displayed?

    Thanks!

    Thread Starter Tanya

    (@gazette-gal)

    Thank you. No the pages aren’t displaying the header image, I’ve just set the feature images to be the same image as the header to “fake it” lol. I don’t actually need to use the feature images on my posts because I use CoSchedule for my social sharing, so it worked to just use the same pic for the feature image on every other post. It’s close enough for my needs, though not perfect. You can see the difference between these two posts:

    No feature image:
    https://panopticnews.com/foundations/use-an-online-presence/

    Feature image:
    https://panopticnews.com/foundations/components-of-an-online-presence/

    Siobhan

    (@siobhyb)

    Hi @gazette-gal,

    It does seem like there’s an issue with your child theme. I’ve asked for some more details on your setup over on this thread:

    https://www.ads-software.com/support/topic/zoom-crop-of-header/#post-8477664

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Stop feature images from displaying as headers’ is closed to new replies.