• Resolved nellie.g

    (@nellieg)


    I want to remove my custom header image from specific pages and can’t figure out how to do this. I copied my header.php file into a pastbin here: https://pastebin.com/MRBevKxk

    I’m new to all of this so please be as specific as you can with code and where I’m supposed to put it. Should I work it into the html of the page itself or the header.php file?

    I’ve looked at numerous posts on removing headers from single pages and found the code etc that people have posted and they seem to have resolved that person’s problem. Unfortunately when I tried them they didn’t work.

    THANK YOU SO MUCH IN ADVANCE!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Don’t edit the Twenty Ten theme. Instead create a child theme for your changes. Once your child theme is active, we should be able to help with the customisation.

    Thread Starter nellie.g

    (@nellieg)

    Done. I now have a twentyten-child theme activated. Other than having to change a few formatting things that didn’t save etc I am ready to customize away.

    So any help at all with removing a custom header image from individual pages would be great. At the moment I have three smaller pop-up windows that play audio and I’d like to remove the header image from each of them. I will definitely have more in the future if that affects any of your advice. I’m really elementary at all this so please simplify!

    Thanks esmi!!

    Do you want to remove the featured image/custom header image from all static Pages?

    Thread Starter nellie.g

    (@nellieg)

    no definitely not. We have 3 pop-ups windows that play audio and we want them to be small and our custom header image takes up too much of the window.

    First, you would need to create a custom page template in your child theme’s folder. Then make a copy of header.php in your child theme, edit the file and immediately after <div id="site-description"><?php bloginfo( 'description' ); ?></div>, try adding <?php if( !is_page_template( 'file_name_of_your_custom_page_template_goes_here' ):?>. Then add<?php endif;?>immediately before</div><!-- #branding -->.

    Thread Starter nellie.g

    (@nellieg)

    Okay. so I’ve created two files.

    1. My custom page template file PopUp.php https://pastebin.com/xq8UZcxb. I simply added the first five lines of code to create the template and then copied the page.php code from the Twenty Ten template.
    Question: Is this all I need to include?

    The second is my Header.php for which I did the edits you suggested. Here is the edited section: https://pastebin.com/zVic1e64
    Question: There was already a <?php endif;?> on line 13 so I added your code to lines 2 and 14 and lined them up. Can you confirm that the spacing is correct?

    I’m off to create a add these files to my directory. Crossing my fingers. Thanks for everything.

    Thread Starter nellie.g

    (@nellieg)

    Okay, I’ve loaded the files into my child theme directory. I can now see the two files on my dashboard. Unfortunately I have a new problem, now this appears in my browser when I try and go to my site:

    ‘Parse error: syntax error, unexpected ‘:’ in /data/8/1/119/96/1771422/user/1915381/htdocs/ulyssesroot/wp-content/themes/twentyten-child/header.php on line 67.’

    Line 67 is this line:
    ‘<?php if( !is_page_template( ‘popup’ ):?>’

    I tried using the full file name ‘popup.php’ and then tried a semi colon instead of a colon and then neither a semi-colon or a colon, and none of the above worked, I’m still getting this error. Any advice!!?!?

    That line should be <?php if( !is_page_template( 'popup' ) ):?

    Thread Starter nellie.g

    (@nellieg)

    After adding a ‘>’ to the end of that, the error message went away, thanks. So now I have my two files but in the dashboard, when I assign the popup template to a page there’s no change.

    I noticed this section in my popup.php file:

    ‘<?php
    /* Run the loop to output the page.
    * If you want to overload this in a child theme then include a file
    * called loop-page.php and that will be used instead.
    */
    get_template_part( ‘loop’, ‘page’ );
    ?>’

    Does this have anything to do with me? It seems relevant but I know so little about wordpress that I’m not sure. I’m doing some reading now on loop, overload, get_template_part etc. but any help would be greatly appreciate.

    Thread Starter nellie.g

    (@nellieg)

    I have 3 php files in my child theme

    1. header.php
    2. loop-page.php
    3. popup.php

    I added the code you suggested and I’m just not having any luck. Can someone please help me remove my header image from my custom page!?!?!?

    Thread Starter nellie.g

    (@nellieg)

    phew, I solved it.

    For those that want to remove header image from specific pages in twenty ten theme:

    1. Create Child Theme
    2. Create Custom Page Template file in child theme (example from above popup.php)
    3. Create header.php file in child theme (copy header.php from parent theme)
    4. add this code to new header.php file in child theme

    after ‘<div id=”site-description”><?php bloginfo( ‘description’ ); ?></div>’
    add ‘<?php if( !is_page_template( ‘popup.php’ ) ):?>’

    and right before ‘</div><!– #branding –>’
    add ‘<?php endif;?>’

    4. copy loop-page.php file from twenty ten and add to child theme (not sure this is necessary)

    Thread Starter nellie.g

    (@nellieg)

    thank you ESMI!!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Omitting Custom Header Image from Single Pages’ is closed to new replies.