HI, I am new to this forum. I came across an old thread on this subject - I needed a different header for each page on my wp site, but it didn’t help me much, mostly due to my lack of knowledge on the php subject. I found this code somewhere along the line in my days of searching for an answer, that seemed to work…at first
then I created all the different page divs in my CSS file using their page name id’s.
it works great for all the pages, but then I discovered that when I do a search on the site, there is no header image for any searched items because I haven’t allocated a div but each search has a different page name like '?=“whatever is typed”
can anyone shed some light on what I am supposed to call the div for a general search page…if there is such a thing? or am I going about this all the wrong way
I tried that code instead of what i had and it changed the headers for all the pages except the home page, there was nothing and then when I did a search it put the original header image in the body and the image from the page I searched from in the correct place!?
this Idea made me think of another way to maybe do it - leave the original code and just call 7 different images to the 7 pages I want with different header images. Any Idea how that should look? I tried something like below but I have syntax errors, dont think I am closing the tags properly:confused: Also I think I will land up with the same search page problems…sigh
yes, accommodation is the page slug name as I am using permalinks note page id’s.
Seems as I have solved the problem!!! I cant express my happiness right now.
Turns out I added a file called search.php to define how the search pages looked and that was causing all the chaos - so I just deleted it and now my search quires work except for - not found!? This has no header image at all?
also is_front_page is not a valid function. use is_home()
search.php is an included file in the core package of wordpress, it is not found because you deleted search.php. there are ways to direct search elsewhere i believe, but don’t want to dig around how.
My theme never had a search.php, I just added that when I was trying another solution for my search page problem, which I then forgot about but my search pages are now fixed, just the “not found” search result that has no image
When I added is_home instead of is_front_page then the home page image disappears.
I see now what it is doing; when i do a search for a word that is found on my site then it uses the header of the first page that comes up in the search results, ie if I search for gallery then it uses the gallery pages image - so when I type in a word that is not found in the site it cant find a header image cause there is no page associated with the searched word. Maybe I should just live with that, cause if it cant be found then I guess the searcher is in the wrong place to start