The MU forums have moved to WordPress.org

Search code help (3 posts)

  1. carnold
    Member
    Posted 16 years ago #

    OK, i am trying to put a live search on the home blog. Ultimately, i would like this search to search all blogs but for now, i just want to get the search working. I use 1.3.3 with black minimalist theme, which is a modified k2 theme. At http://mytimewithgod.net/demo is where i am working for now. Here is the code that i have now that puts the search where i want it:
    <div class="alignright">
    <table align="center">

    <tr>

    <td class="vertical" width="212"><div class="secondary">

    <div class="sb-search"><h2><?php _e('Search Blogs'); ?></h2>

    < ? php include (TEMPLATEPATH . '/searchform.php'); ? >

    </div>
    </td>
    </tr>
    </table>
    </div></div>

    I do not use a sidebar on this site; so i took the search code from sidebar.php and copied it to my index.php. When i copy the entire code into index.php, the "search blogs" is completely gone. Here is the entire code:
    <div class="alignright">
    <table align="center">
    <tr>
    <td class="vertical" width="212"><div class="secondary">
    <div class="sb-search"><h2><?php _e('Search Blogs'); ?></h2>
    < ? php include (TEMPLATEPATH . '/searchform.php'); ? >
    </div>
    </td>
    </tr>
    </table>
    </div></div>
    < ? php } ? >

    < ? php global $notfound; ? >

    < ? php /* Creates a menu for pages beneath the level of the current page */

    if (is_page() and ($notfound != '1')) {

    $current_page = $post->ID;

    while($current_page) {

    $page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");

    $current_page = $page_query->post_parent;

    }

    $parent_id = $page_query->ID;

    $parent_title = $page_query->post_title;

    if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_status != 'attachment'")) { ? >

    < ? php } } ? >
    So my question is what code do i need to use to make this work on the home blog?

  2. lunabyte
    Member
    Posted 16 years ago #

    There's this service called pastebin, where you can post (and then link to) long stretches of code and such. Please check into it. Thanks.

  3. carnold
    Member
    Posted 16 years ago #

About this Topic