• Resolved kgg97

    (@kgg97)


    I am trying to follow the instructions for inserting a header image. I copied the code snippet and am trying to insert it into header.php, but when I click on the link header.php it says the requested theme does not exist. I am not sure what that means or what I should do from here.

Viewing 15 replies - 1 through 15 (of 25 total)
  • Plugin Support ibulbworksupport

    (@ibulbworksupport)

    All themes do not have header.php. Maybe you are using a child theme and only parent theme has header.php. It is recommenced to copy header.php from parent theme and paste in child theme. You can add shortcode for header images in parent theme’s header.php.

    Thread Starter kgg97

    (@kgg97)

    How would I go about copying and pasting header.php from parent theme to child theme?

    @kgg97 All themes do not have headers.php file. So, You can try the code snippet in page.php or single.php it will also work in these files.

    Please let us know that, If this method works for you

    Thanks

    Thread Starter kgg97

    (@kgg97)

    Where would I find page.php to insert the code snippet? I’m not sure because there’s not a link for it like there is for headers.php. Sorry I don’t know much about WordPress. Thank you

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    Can you please check your admin panel and Appearance > Theme Editor? There you will see all the available files. You may share your screenshots so we can help you better.

    @kgg97 Please see the below given screenshot I hope it will help you to add snippet from admin dashboard.

    https://paste.pics/BIV52

    Thanks

    Thread Starter kgg97

    (@kgg97)

    Since my theme apparently doesn’t have a header.php I inserted the snippet into page.php. However this put the image on every page of my blog when I only wanted it on the home page.
    @joelparker I have the heaeder.php in the theme editor but I don’t want to directly edit the theme because I’ll lose my edits when the theme automatically updates.

    @kgg97 Yes, It is not recommended to edit header.php directly in parent theme, you should use a child theme then you can easily edit any file of theme without losing any edit.

    For child theme you can use any child theme creator plugin or tell me your theme name may be I can suggest you any child theme of your current theme.

    Thanks

    @kgg97 If you want to use header image only on home page, you can wrap snippet with home page or front page check.
    You can also use below given snippet, with this image will show only on home page.

    
    <?php
      if(is_home()){
          do_shortcode('[WP_HEADER_IMAGES]');
       }
    ?>
    
    • This reply was modified 3 years, 9 months ago by joelparker.
    Thread Starter kgg97

    (@kgg97)

    @joelparker I am not sure if I’m using a child theme or a parent theme currently but my theme is Carbis. It’s ok to edit the theme directly if I’m using a child theme?

    I also inserted this snippet where I believe it is supposed to go on page.php but now I have no header at all.

    @kgg97 Please check file style.css in theme editor if there is a template tag at the top of file then it’s shows that it is a child theme like showing in below given screenshot. You can also share the screenshot of style.css from the top of file.

    https://paste.pics/BJ5HF

    Thanks

    Thread Starter kgg97

    (@kgg97)

    @joelparker Ok so it looks like I have a parent theme because there’s no template tag? How would I make it a child theme instead?

    https://paste.pics/BJJ3M

    Also this is where I put that snippet and I got no header at all.

    https://paste.pics/BJJ4H

    Thread Starter kgg97

    (@kgg97)

    Thank you for your help everyone. I have created a child theme that I am using, so the problem I still have is that the header is on every page when I only want it on the home page. When I use this snippet:
    <?php
    if(is_home()){
    do_shortcode(‘[WP_HEADER_IMAGES]’);
    }
    ?>
    @joelparker it gives me no header. Thanks!

    @kgg97 Please try below given snippet and let my know if this snippet works for you.

    
    <?php
     if(is_home() || is_front_page()){
       do_shortcode(‘[WP_HEADER_IMAGES]’);
     }
    ?>
    

    Thanks

    • This reply was modified 3 years, 9 months ago by joelparker.
    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @joelparker please consider single quote as apostrophe or double quotes, because inverted commas will not work in PHP scripts.

    <?php
     if(is_home() || is_front_page()){
       do_shortcode('[WP_HEADER_IMAGES]');
     }
    ?>
Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘header.php Won’t Open’ is closed to new replies.