Results 1 to 1 of 1

Thread: Searching Listings vs Posts/Pages

  1. #1
    Thread Starter
    simedia's Avatar
    Join Date
    Jan 2013
    Location
    United States
    Posts
    71
    Thanks
    33
    Thanked 3 Times in 3 Posts

    Searching Listings vs Posts/Pages

    As I understand it so far, the theme search function at the top of our Vantage site searches 1) business listings and 2) events.

    The WP Search Widget in the sidebar, however, searches 1) pages and 2) posts.

    I've struggled to find a plug in (as much as I hate to add another one) which includes EVERYTHING -- posts, pages, and listings -- in the search results.

    It's frustrating to need two different types of searches, neither of which seem to cooperate with the other. I did find the "Search Everything" plug in as recommended by "Dave's Live Search" but that, too, only searches posts and pages, and not Vantage listings.

    I tried added a line of code to our functions.php file (in a child theme) as shown below, as recommended on a forum post, to include the following code, but, it appears adding "listings" where shown isn't correct (or complete).

    Does anyone have input, ideas, plug-in recommendations, or code hacks we can use to make sure that the sidebar search widget includes listings in the results?

    -----------------------
    code added to child theme functions file, which wasn't correct/adequate
    -------------------------
    function filter_search($query) {
    if ($query->is_search) {
    $query->set('post_type', array('post', 'listings'));
    };
    return $query;
    };
    add_filter('pre_get_posts', 'filter_search');

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mapsupreme when searching listings
    By leaddog in forum Mapsupreme
    Replies: 23
    Last Post: September 5th, 2013, 05:41 AM
  2. map not showing when searching listings
    By walton in forum Mapsupreme
    Replies: 8
    Last Post: July 9th, 2013, 03:20 AM
  3. Searching on the Category Pages using keywords field
    By evantage in forum ClassiPress General Discussion
    Replies: 3
    Last Post: April 25th, 2013, 05:40 PM
  4. Can't put links in pages/posts and invisible text on pages/posts
    By consignor in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: September 24th, 2012, 07:21 PM
  5. [SOLVED] Indeed listings displayed on Homepage but disappear when searching
    By huydoan in forum Report JobRoller Bugs
    Replies: 17
    Last Post: March 8th, 2012, 01:27 PM