Remove header image on image post pages in Wordpress
August 24, 2012 10:19 AM   Subscribe

Wordpress: help me get rid of the header image on image post pages.

I'm in the process of learning to edit Wordpress themes and I'm stuck on a particular problem: how get rid of the header image on image post pages.

Currently, when a thumbnail for an image is clicked you are then brought to a page with the image at full size. But, because of the large header image, you have to scroll down a bit to see it - clunky. I want to remove the header image on those pages (and only those pages).

The URL for the website I am working on is in the About section of my profile if you want to take a peek. I'm using a child theme based on TwentyEleven.

I did already post this question to the Wordpress forums a bit ago and have not yet heard back.
posted by jammy to Computers & Internet (3 answers total) 2 users marked this as a favorite
In header.php find:
$header_image = get_header_image();
if ( $header_image ) :

and replace it with:

$header_image = get_header_image();
if ( $header_image && !is_attachment()) :

posted by Memo at 10:56 AM on August 24, 2012 [1 favorite]

I believe you want to create a attachment.php that's a copy of your index.php.

Inside this attachment.php file, remove whatever code your header is in.

If you still need *parts* of the header on that page, then you may need to do as Memo suggests, and surround your header call with:
<?php if (!is_attachment): ?>
...header img tag, etc...
<?php endif; ?>
This obviously depends on how the theme was built.

Also, WordPress Forums are less good than the WordPress StackExchange.
posted by artlung at 11:55 AM on August 24, 2012 [1 favorite]

thank you both! i used Memo's method and it is working peachy.
posted by jammy at 5:13 AM on September 2, 2012

« Older talking to strangers waaaahaa   |   Does anyone recognize this music? [Radiohead... Newer »
This thread is closed to new comments.