Title: Adding a search.php to my theme
Last modified: September 26, 2016

---

# Adding a search.php to my theme

 *  [kcox117](https://wordpress.org/support/users/kcox117/)
 * (@kcox117)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/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_Page](https://codex.wordpress.org/Creating_a_Search_Page)
 * And 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](http://playground.boardtronics.com/?s=install)
 * username: admin
    password: matrix1
 * This 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](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!

Viewing 1 replies (of 1 total)

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/adding-a-search-php-to-my-theme/#post-8224119)
 * The “easy” way to do it is to copy another page template file (I’d recommend 
   stating with your themes `index.php` file) into your `search.php` file and making
   the changes that you want from there.
 * Oh, and as a warning, you should be doing this in a [child theme](https://codex.wordpress.org/Child_Themes).
   If you do this in your main theme and there’s any future updates, it will wipe
   out any modifications that you’ve done, including adding this new file.

Viewing 1 replies (of 1 total)

The topic ‘Adding a search.php to my theme’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/adding-a-search-php-to-my-theme/#post-8224119)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
