Title: Customizing search with a function
Last modified: April 9, 2019

---

# Customizing search with a function

 *  [vijayj](https://wordpress.org/support/users/vijayj/)
 * (@vijayj)
 * [7 years ago](https://wordpress.org/support/topic/customizing-search-with-a-function/)
 * I need to modify the default search in WP.So created a function in function.php
   which search the database. I don’t know how to add the function to search.
 * The function result is an array containing 4 values.I need to display the contents
   in my own design
 * The theme i use have search.php and searchform.php.
 * Please help
 *     ```
       <div class="thumbnail">
       <img />">
       <a>"> <?php echo $data[0]; ?></a>
       <p><?php echo $data[2]; ?> </p>
              </div>
       ```
   
 * This shold be the format of the search result
    -  This topic was modified 7 years ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: Formatting

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years ago](https://wordpress.org/support/topic/customizing-search-with-a-function/#post-11409242)
 * The default search is for posts. If you want to search for something else, you
   are better off implementing a separate search functionality independent of the
   default search. If you want to intersperse your results with posts found, you
   are still looking at two separate searches. The results can be interspersed with
   template code.
 * The pagination of two different interspersed searches gets messy. You are really
   better off with completely separate search functions.

Viewing 1 replies (of 1 total)

The topic ‘Customizing search with a function’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/customizing-search-with-a-function/#post-11409242)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
