• will someone tell me how create a search like the one on this website…
    http://www.trulia.com/

    I want people to be able to search my pages NOT my posts. I have a similar real estate website where I’d like my clients to be able to search by square footage, monthly rental rate and location. That’s pretty much it. If anyone can help me I will forever be grateful and when I have grand kids I’ll tell them stories of how you are my he

Viewing 6 replies - 1 through 6 (of 6 total)
  • something along these lines

    function SearchFilter($query) {
      if ($query->is_search) {
        // Insert the specific post type you want to search
        $query->set('post_type', 'page');
      }
      return $query;
    }
    
    // This filter will jump into the loop and arrange our results before they're returned
    add_filter('pre_get_posts','SearchFilter');

    in your functions.php

    perhaps

    Thread Starter wchandler2

    (@wchandler2)

    Is there a more simple way to do it?

    Looks like this plugin can be configured to search only what you want:

    http://ww.wp.xz.cn/plugins/search-everything/

    it says you can exclude posts but I haven’t used it.

    try googling “wordpress search plugin exclude posts” or “wordpress search plugin only pages” or whatever

    e.g. http://ww.wp.xz.cn/plugins/simply-exclude/

    Thread Starter wchandler2

    (@wchandler2)

    Thank you. What I don’t get is how to actually get a search function. I have my search.php but don’t get how to actually have a search engine on my website.

    you mean you want to add the search box?

    the code for that is <?php get_search_form(); ?> afaik

    you might want to look in the widgets section, there may be a search box in there you can just drag into the sidebar.

    Thread Starter wchandler2

    (@wchandler2)

    Here’s my website… hidefspaces.com
    it only has a little search box at the top right that isn’t really customizable. I’d like to have maybe just a page itself that is used to search properties like the one on trulia.com

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Create a search engine’ is closed to new replies.