I am trying to add the search feature to our site. I have the search feature located in the desired position on the page so I'm happy with that. My problem is that when the results are displayed, instead of showing a standard heading like " Search Results" in the header the results page displays the title of the first page that contains the search term.
Hope that's not confusing. I need to be clear that this relates to the title in the header and not the title in the content, the title in the content is fine with "Search Results For:"
I'm thinking I need an "if,then,else" statement in the Header.php file so it uses a different title when the search feature is used.
I am working locally on my computer to try and get this done and have created a child theme of the original. In the child theme folder I have search.php, header.php, style.css and functions.php
I've been stumbling my way through this but think the following line in header.php file is where a revision is required.
<h1 class="site-title"><?php echo get_the_title($post->ID); ?></h1>
Any help is greatly appreciated, I've spent hours on this!
David
`code here`
to add inline code, or use 4 spaces at the beggining of each line to add blocks of code (you can also add blocks or code pressing{}
symbol in the editor.