• 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 5 years, 11 months ago by Jan Dembowski. Reason: Formatting
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    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.