how do I customize search results?

How do I get results from options table to show up in search results

  • Paul
    • Design Lord, Child of Thor

    I have changed the parameters of the question a bit as my direction has changed a bit with my project. However the question is still similar to the above and is as follows:

    I have built a custom table called ‘table_address’. The way my project is set up, I only need that table and its fields for storage(I won’t be using wp_post or any of the other wp tables. Therefore, when a user submits my search box, via a custom-template page, I would like the content from custom table to be displayed on search results page. I have found that $wpdb is the way to go for this, but I’ve yet to get it working. Mainly, the thing that I’m puzzled about is how to connect search to the custom table. Please see code below:

    global $wpdb;
    global $myrows;
    // do your funky SQL

    function my_custom_query($myrows) {
    if(isset($_GET['search-custom-table']) && $_GET['search-custom-table'] != '') {
    global $wpdb;
    $address_table = $wpdb->prefix . "address_table";
    $myrows = $wpdb->get_results( 'SELECT * FROM ' . $address_table );
    print_r ($myrows);
    return $myrows;



    <form method="get" action="">
    <input type="text" name="search-custom-table" id="search-custom-table" />

    <input type="submit" class="" value="Search" onClick="<?php my_custom_query(); ?>" />

    Here is the url I’m getting as results: ‘/?search-custom-table=grove+city’. However,it displays all of my content and not as a search results page. It just displays as though it were the front-page, which to me says that something is working, but not quite correctly. Please Helppppp :wink:

    Also, this is something I am developing, so using a plugin is not an option, thanks ~

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.