• Resolved cheddargeorge

    (@cheddargeorge)


    I have a child theme which I’ve implemented, which works okay, but I need to display a banner in the header section (i.e. at the top of the page), where there is no widget area. The idea is that I use a custom field to identify some aspect of the page, and then display a banner according to that value.

    So, I found that I could copy header-main.php into /my-child-theme/parts/, and add some additional code which identifies the field value and then queries a non-WP database. This works okay too. No problems.

    However, I realize that when the main theme gets updated my header-main.php file (in the child theme) will not get updated, which could later cause issues.

    So, I’m wondering if there is a better way or, rather, a correct way of achieving what I’m attempting to do, taking account of the fact that I need the banner to be in a specific place in the header section? Or is the method I’m using the best way already?

    Any suggestions/help appreciated. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • What you’ve done is the best way. If you want to use a parent theme then you just have to deal with the possibility of it updating. Only alternative is to create your own theme out of whole cloth. That said, unlike plugins a theme should (ideally) never change so dramatically in an update that this would be a problem.

    Thread Starter cheddargeorge

    (@cheddargeorge)

    Okay Jacob, thanks for the comment. I just wanted to make sure I was using the best/proper way of doing it before getting too far with it.
    It does work okay, so I’m happy with that; yeah, hopefully the parent theme won’t change too much. I don’t really want to create my own new theme [yet], so I guess I’ll stick with the method I’m using.
    Thank you again for your thoughts!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Query about Modifying Header File’ is closed to new replies.