• Hello Guys!

    I’m building a plugin thats modify header like adding background colors, replace logo etc. I want it to override the theme’s header.php or get_header() function from my plugin also I wanted the original theme’s header.php stays there in the theme.

    Creating a plugin that can work on all themes is not possible since WordPress does not have a clear “filter” or “action” hooks for header Its just a simple file named header.php. Thats why my plugin only supports three themes. Unfortunately all these three themes have different functionality for their header. So any suggestions or ideas will make my life easier ??

    Thanks

    • This topic was modified 8 years, 6 months ago by Omer Hussain.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Omer,

    Did you manage to get a response on this issue? I have been looking for a solution for a while as well.

    Ali

    Thread Starter Omer Hussain

    (@omerblink)

    No I haven’t got any reply… So made my own solution

    Cool, any chance you could share that solution :)?

    Thread Starter Omer Hussain

    (@omerblink)

    Actually I have done it this way: When my plugin activated … It creates a backup of the current theme’s header.php and put my own modified header.php in the theme. And when deactivate the plugin it reverse the process.

    Let me know

    Great thanks for that Omer, however it’s not going to work for me, I only need it to load the custom header.php when it’s on a specific post-type which gets created once my plugin is enabled.

    The header.php needs to stay intact for all the other pages as it was before unless my custom post is accessed the header should be replaced with mine.

    Thread Starter Omer Hussain

    (@omerblink)

    You can use the same method. You can replace the header.php with your own header.php when accessing a specific post type. Like Im doing it on activate / deactivate.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Override header.php or get_header() in the theme’ is closed to new replies.