Adding a search.php to my theme
-
Hi guys,
So I’ve been struggling with an issue when it comes to my wordpress search results. I’ve read this article:
https://codex.wordpress.org/Creating_a_Search_PageAnd I have no problem creating my own search page/search box. The problem for me is in the results.
See this page: http://playground.boardtronics.com/?s=install
username: admin
password: matrix1This is a search results page for the keyword “install”, which should bring up a lot of results on my site. But go ahead and inspect element on the page and look at the code, and you’ll find the results are there – the divs are there – but the divs are empty. It’s as if the system knows the exact pages/posts to return, but doesn’t actually display any code inside the divs.
I’ve read the way you’re supposed to customize your search results is via the search.php template in your theme, but by default, my theme doesn’t have one. I created one in my theme and filled it with “<p>hello</p>” and when I went to that search result page again on my website (http://playground.boardtronics.com/?s=install), it was an entire white page with the word “hello” on it, as expected. So when I create a search.php file within my theme, it does have control over those results. (I’ve since deleted the search.php file so that you can look at the problem).
So I’m looking for code to put into a search.php template, or any type of direction that will actually allow the results to show up on my search results page.
Let me know if you have any questions, and thanks in advance for your help!
The topic ‘Adding a search.php to my theme’ is closed to new replies.