Custom post types

1 month ago | Mikkel Mortensen (Member)

With WP 3 comes custom post types. How do I make SU search within these?

Read responses...

Responses

  1. Coupon Savings:

    Posted 1 month ago by Member

    Was wondering the same thing, so I just dug into the code and tweaked a bit.

    In spider.php, look for the code that creates the SQL for generating the search index. It's in the SearchSpider function.

    The first thing I did was add the custom taxonomies to the type array:


    $type[] = "{$wpdb->posts}.post_type='taxonomy1'";
    $type[] = "{$wpdb->posts}.post_type='taxonomy2'";

    Then, tweak the WHERE clause in the SQL:


    AND {$wpdb->posts}.post_type IN ( 'post', 'page', 'taxonomy1', 'taxonomy2' )";

    This seems to work for me so far.

    Admittedly, it's a hack, but I didn't really want to completely re-write the admin to determine all taxonomy types and add check boxes for each, then re-write the function to gather that data and generate the SQL.

  2. Derek Perkins:

    Posted 3 weeks ago by Member

    I'm very interested in this as well. It is weird to me that your hack is working, because the code is looking for custom post types, not taxonomies.

    Any chance that custom post types will be officially supported in the near future?

Reply

You must log in to post.

Home | Software | Terms & Conditions | Sitemap | John Godley © 2010