Twenty Fourteen Theme: Custom Search Results Page

The Twenty Fourteen default theme for WordPress includes a search.php file which includes several template tags.

Here’s the default search page which includes the featured image and entry meta.

default search

If you want to customize what displays on your search results pages, you will need to copy over the search.php file to a child theme.

Inside the search.php file you’ll find a loop which includes this template tag:

get_template_part( 'content', get_post_format() );

To modify what the content.php file does in your search results loop, copy over the content.php file to your child theme and rename it to something like customsearch.php.

Then change the above line of code to:

get_template_part( 'customsearch' );

Now you can modify the code in your customsearch.php file to customize the functionality of your search results page and even style it differently to the default.

The Code

Here’s the code for the 2 files you need to create in your child themes root directory.

Example of Customized Search Page

Here’s a very basic example of how you can customize your search results page using the Twenty Fourteen theme.

Here’s what the above code produces:

custom search page

Related Tutorials


Comments

4 responses to “Twenty Fourteen Theme: Custom Search Results Page”

  1. John Tricoli Avatar
    John Tricoli

    Hi, I’m running twenty fourteen and I am trying to get my search results to show full screen…in other words have the left sidebar disappear when the search results show.

    The search results are full screen on an ipad, but on a desktop the left sidebar always shows up.

    I’ve tried Fourteen Extended, but the full screen / search results option is not working.

    I have a child theme, and I am just trying to figure out the syntax. Can anyone help me? Thanks!

    1. Brad Dalton Avatar
      Brad Dalton

      Hello John

      My quote is $65 to code a custom template for you which displays full width on the desktop

      1. Is there a way to have the comments looped as the search results? I have only found one plugin yo do this and I’m told its bogging down my site, an the search is super slow. Perhaps it’s because we have nearly 400K (not a typo) comments on our home page…but the comments themselves *are* our content. Pretty much, primary content is user generated by commenting. Also looking for a developer to partition comments table.,.

        1. Brad Dalton Avatar
          Brad Dalton

          What theme are you using?

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.