Greetings Experts --
I am looking for a way to insert arbitrary php code in or above the header on the home page and only the home page of a WordPress site. Alternatively, in true WordPress fashion, the code could exist on every page and just be operative on the home.
My immediate application is to affect a page redirect if the user is on a mobile device. From what I have read, this has to happen before any text is sent to the browser - hence my "above the header" preference. Anyway, the theme is plenty responsive under normal circumstances, and it would be a waste of time to create an alternative version of every page. However, the home page is so image intensive that no amount of responsiveness is going to make it palatable on a mobile.
Theme 'X' v4.0.7, Stack 'Renew'
I also have a rudimentary child theme ('X - Child Theme: Renew') to facilitate blogger home pages and to format the list of bloggers like other lists.
I have done due diligence in seeking out existing solutions and found that I am going to need a bit more hand-holding than the typical person asking this type of question. For example, there is
Redirect to first page form
I understand the php code, but not how to get it into or above the html header.
Another one is
I can find no file by the name of "page-template" in the WordPress or X hierarchies, although there is a "post-template". The latter consists entirely of function definitions, and nowhere contains the word "header".
Thank you for your indulgence,