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.
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:
Leave a Reply
You must be logged in to post a comment.