0

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.

1

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' ) : ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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