Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using a child theme of twenty-twelve, and want to remove the huge banner image in the header for certain post types. How can I use add_filter() or add_action() to do this? I don't want to mess with the header.php file in the parent theme, I just want to preg_replace the HTML content that the header has. Excuse my ignorance, but I am fairly not versed in WP yet.

share|improve this question
add comment

1 Answer

Copy header.php to your child theme so you're not editing the parent theme's file. And on line 49, you will see this line of code:

if ( ! empty( $header_image ) ) : ?>

This says if header image is not empty show the header image. So you can add to that condition to check for any post type you want. Like this example:

if ( ! empty( $header_image ) && get_post_type() !== 'my-posttype' ) : ?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.