Pippins Plugins
  • Email
  • Facebook
  • Feedburner
  • Github
  • Google
  • Twitter
  • Vimeo
  • Youtube
  • Rss
  • About
  • News
  • Join the Site
    • Member Benefits
    • Member Plugins
    • Email Notifications
  • Plugin Store
    • Affiliate Area
    • Checkout
  • Plugins
    • Plugin Portfolio
      • Plugin Portfolio – List View
    • Free
    • Premium
    • Member Plugins
    • Coding Standards
    • Get Plugin Support
  • Tutorials
    • Series
      • Plugin Development 101
      • Creating a User Follow System Plugin
      • Customizing Restrict Content Pro
      • Displaying Content with Easy Content Types
      • Writing Your First WordPress Plugins, Basic to Advanced
      • Working with Widgets
      • User Submitted Image Galleries
      • Plugin Thoughts
      • Integrating Stripe.com with WordPress
      • WordPress Rewrite API
    • Member Exclusive
      • Free Members
      • Subscriber Only
    • Difficulty
      • Beginner
      • Intermediate
      • Advanced
    • Action and Filter Hooks
    • Ajax
    • Custom Post Types
    • External APIs
    • Short Codes
    • Taxonomies
    • Video Tutorials
    • Widget Tutorials
    • WordPress Admin / Dashboard
    • Working with jQuery
    • WordPress Database
    • Writing Plugins
    • Tag Index
  • Reviews
  • Support Forum
  • Contact
    • Support the Site
    • Request Code Review
    • Plugin Support

Advanced Search Short Code

Posted on August 1, 2012 by Pippin in Member Plugins, Member Restricted, Plugins, Premium, Shop, Short Codes, Subscriber Only, Utilities 128 Comments
Home» Member Restricted » Member Plugins » Advanced Search Short Code
Search
Tweet
Love It - 10

Advanced search forms are something almost every large site wants, especially since they make it dramatically easier to find content across the site. This is a simple plugin that provides a short code that displays an advanced search form on your site. The search form includes the options to search in any and all post types, tags, categories, and any custom taxonomy. As a short code, it’s extremely simple to setup and you can have an advanced search form added to your site in less than five minutes.

One of the great things about this plugin is that it allows you to add an advanced search form to your site, but without modifying any of your existing functionality. Still want a simple search form? No problem.

The search form is placed on any page with the following short code:

[advanced_search]

By default, the form will include options to search in categories, tags and all public post types, including both posts and pages. Categories and tags will both be outputted as radio options.

The short code accepts several parameters:

  • categories=”1″
  • tags=”1″
  • post_types=”1″
  • excluded_post_types=NULL
  • taxonomies=NULL
  • style=”radio”
  • search_text=”Key Words”
  • placeholder=”Enter search terms”
  • search_type_text=”Search by Type”
  • search_cat_text=”Search by Category”
  • search_tag_text=”Search by Tag”
  • search_tax_text=”Search by %s”
  • search_text=”Search
  • url=”http://yoursite.com”

If you wish to disable the categories, tags, or post types, simply set their parameter to 0, like this:

[advanced_search categories=1 tags=0]

By default, setting post_types to 1 enables all public post types, but since you may not want users to have the option to search in some particular post types, you can simply pass the name of post types to exclude to excluded_post_types, like so:

[advanced_search categories=1 tags=0 excluded_post_types="books,movies"]

With excluded_post_types=”books,movies” neither books nor movies will be available as post types to search in.

You can also enable options to search in any custom taxonomy as well by passing the names of the taxonomies to the taxonomies parameter, like this:

[advanced_search categories=1 tags=0 taxonomies="genres,topics"]

With taxonomies=”genres,topics”, both the Genres and Topics taxonomies will be available as options.

The final parameter, style, lets you define whether the categories, tags, and taxonomies should be shown as radio or select options. To show them as select menus, simply use the short code like this:

[advanced_search categories=1 tags=0 style="select"]
Screenshot from 2012-08-01 14:31:07
Screenshot from 2012-08-01 14:31:27
Screenshot from 2012-08-01 14:31:51
Screenshot from 2012-08-01 14:32:05
Change log

Version 1.1
Added new parameters to change the titles of each section.
Added a new “url” parameter.
Added a new parameter for changing the search button text.
Added a new parameter for changing the placeholder text in the key words input.

Version 1.0
Initial release.

As a premium subscriber, the plugin is free to download and use as much as you wish.

Not a subscriber? Signup today and get immediate access to this plugin and more.
If you wish, you can also purchase the plugin below, without registering as a subscriber.

Checkout Loading — Item successfully added to your cart.

Already a premium subscriber? Login below to download this plugin for free

Lost your password?

Tweet Follow @pippinsplugins
advanced search, search

128 comments on “Advanced Search Short Code”

Comment navigation

← Older Comments
  1. Adam says:
    December 20, 2012 at 5:41 am

    Hi Pippin,

    (I’ve just found your website after finding your plugin on CodeCanyon.)

    I thought I’d explore what else you had to offer and after reading about this post noticed this message:

    Not a subscriber? Signup today and get immediate access to this plugin and more.

    However there is no link to Signup? You might want to make it a link as now I have to search around to see how to signup. ;)

    Reply
    • Pippin says:
      December 20, 2012 at 4:29 pm

      Whoops! Thanks for the heads up!

  2. Alecs says:
    January 13, 2013 at 9:09 am

    Hi!
    Very nice plugin, I want to buy it but I have one question :
    I’ve created 4 portfolios custom post types like : Villas, Luxury Villas, Apartments, Seaview Apartments
    What I want to have in the search is :
    “Property type” – a drop-down list with “with all these ” villas, luxury villas… ”
    ” Beds” – a drop-down list with ” 2 beds, 3 beds, 4 beds” this will be tags form the custom portfolio posts.

    Is this possible? If so I will buy it.
    Thank you !

    Reply
    • Pippin says:
      January 14, 2013 at 11:36 am

      How are the Property Types populated? Is it a taxonomy?

    • Alecs says:
      January 15, 2013 at 3:07 pm

      I think it is a taxonomy because I can create unlimited portfolios like ” Luxury house ” and there put all the posts related to it and so on …

    • Pippin says:
      January 17, 2013 at 8:32 pm

      You will need to find out for sure before I can help you with it, sorry.

  3. alecs alecs says:
    January 18, 2013 at 12:46 pm

    I don;t know exactly if there are custom post types or custom taxonomies, can you tell me how can I check this quckly ?
    Thank you!

    P.S: I’ve tried to buy this plugin with paypal but is not working :

    This payment cannot be completed and your account has not been charged. Please contact your merchant for more information.

    Reply
    • Pippin says:
      January 22, 2013 at 4:12 pm

      Do you see a transaction in your PayPal account?

  4. Alecs says:
    January 19, 2013 at 8:49 am

    This is the code :


    $portfolio_slugs = get_option("zeitgeist_portfolio_slug");
    if(is_array($portfolio_slugs))
    foreach ( $portfolio_slugs as $slug ){
    add_action('init', 'create_portfolio');
    register_taxonomy("category_".$slug, array($slug), array("hierarchical" => true, "label" => "$slug Categories", "singular_label" => "$slug Category", "rewrite" => true));

    function create_portfolio() {
    $portfolio_slugs = get_option("zeitgeist_portfolio_slug");
    $portfolio_counter = 0;
    $portfolio_names = get_option("zeitgeist_portfolio_name");
    foreach ( $portfolio_slugs as $slug ){
    $portfolio_args = array(
    'label' => __("Portfolio '".$portfolio_names[$portfolio_counter]."'"),
    'singular_label' => __($portfolio_names[$portfolio_counter++]),
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => array('slug' => $slug, 'with_front' => true),
    'supports' => array('title', 'editor', 'thumbnail', 'author', 'comments', 'excerpt')
    );
    register_post_type($slug,$portfolio_args);
    }
    }

    function portfolioSingleRedirect(){
    global $wp_query;
    $queryptype = $wp_query->query_vars["post_type"];
    $portfolio_slugs = get_option("zeitgeist_portfolio_slug");
    if(is_array($portfolio_slugs))
    foreach ( $portfolio_slugs as $slug ){
    if ($queryptype == $slug){
    if (have_posts()){
    global $pcat;
    $pcat = "category_".$slug;
    require(TEMPLATEPATH . '/single_portfolio.php');
    die();
    }else{
    $wp_query->is_404 = true;
    }
    }
    }
    }
    add_action("template_redirect", 'portfolioSingleRedirect');
    [/code]

    In the dashboard I'm allowed to add unlimited portfolios and in each one I can create posts and I can also assing categories for each portfolio created.
    If you want I can give you acces to dashboard to take a look.
    Thank you!

    Reply
    • Pippin says:
      January 22, 2013 at 4:12 pm

      Those are both custom post types.

  5. marco pini says:
    January 22, 2013 at 10:03 am

    Hi Pippin

    i would like to use your plugin “avanced search” for searching in my “custom fields” (i have created custom fields with advanced custom fields plugin)

    it’ s possible to add this type of filtering in the search form?

    thank you very much!!!
    marco

    Reply
    • Pippin says:
      January 22, 2013 at 4:13 pm

      It does not search custom fields, sorry.

  6. Patrick Hess says:
    January 22, 2013 at 3:50 pm

    Hi Pippin -

    I’m having trouble getting the search_text parameter to work. I’m trying it just as suggested above. Any thoughts?

    Thanks,

    Patrick

    Reply
    • Pippin says:
      January 22, 2013 at 4:11 pm

      Can you show me the exact short code you’re using?

    • Patrick Hess says:
      January 22, 2013 at 5:26 pm

      It seems to be working now with my current shortcode: [advanced_search categories=0 tags=0 post_types=0 taxonomies="legalservices,practiceareas" style="select" search_text="Search"]

      Is there a way to hide the Search headline while still showing the search_text in the button? For instance, if use “Add Keywords” as my search_text, it appears as both the heading above the search bar and as the button text. Or is there some way to have different terms in each?

      Thanks.

    • Pippin says:
      January 23, 2013 at 8:37 pm

      You could hide it with CSS, but that’s the only way.

  7. Ebrahim-Khalil Hassen says:
    January 25, 2013 at 1:56 am

    any plans for a widget?

    Reply
    • Pippin says:
      January 27, 2013 at 8:53 pm

      No, sorry.

    • Ebrahim-Khalil Hassen says:
      January 28, 2013 at 1:12 am

      OK. Will the shortcode work inside a widget?

    • Pippin says:
      January 31, 2013 at 5:34 pm

      Yes, though sometimes it requires a minor code snippet be added to your theme.

  8. Patrick Hess says:
    January 31, 2013 at 11:15 am

    I can’t seem to produce any results with the “Any” selection. When I just click search, with Any as the default choice, the page just reloads. Any thoughts? I’m still testing with my site and don’t have all the terms filled with posts yet, in case that helps.

    Thanks.

    PH

    Reply
    • Pippin says:
      January 31, 2013 at 5:34 pm

      You have to enter at least one search term.

  9. cbryant says:
    February 1, 2013 at 6:25 pm

    Hi Pippin,

    This is probably a no-brainer for more advanced users, but…

    Can I insert this into a template?
    If so – what is the php code for doing so?

    Thank you!

    Reply
    • Pippin says:
      February 4, 2013 at 11:43 am

      Yes you can!

      <?php echo do_shortcode( '[advanced_search]' ); ?>
  10. cesare says:
    February 6, 2013 at 10:29 am

    Hi Pippin
    How I can make to the advance search form, when don´t have result for show, display some message?
    Thank you.

    Reply
    • Pippin says:
      February 6, 2013 at 4:52 pm

      Are you familiar with how to modify template files?

  11. Mike Schauer says:
    February 13, 2013 at 2:37 pm

    Love the idea behind this! Likely going to need this for a future project.

    You should totally incorporate custom fields either in this or another plugin. There is one custom fields search plugin I know of: http://wordpress.org/extend/plugins/wp-custom-fields-search/ & it has bugs (hasn’t been updated in 2 years).

    If you could create a custom field search solution (great for real estate, dealerships, directories, online stores etc.), I think it would be really popular. Has that ever piqued your interest?

    Reply
    • Mike Schauer says:
      February 13, 2013 at 3:29 pm

      You can ignore that last comment. Just saw an old comment where you said you’d like to at some point. For now, I’ll try to use more taxonomies instead of fields.

  12. Matthew says:
    February 19, 2013 at 12:34 pm

    Is it possible to exclude Posts and Pages from Advanced Search?

    I tried using: [advanced_search excluded_post_types="Posts,Pages"]
    but it’s still returning results from pages and posts.

    Reply
    • Pippin says:
      February 19, 2013 at 3:42 pm

      Change that to:

      [advanced_search excluded_post_types="post,page"]
    • Matthew says:
      February 19, 2013 at 4:12 pm

      I tried that exact thing a few minutes after posting and it didn’t work. I just tried again now to verify that I wasn’t crazy.

      Here’s the exact code I’m using. Let me know if anything jumps out at you as suspicious:

    • Matthew says:
      February 19, 2013 at 4:15 pm

      echo do_shortcode( ‘[advanced_search categories=0 tags=0 post_types=0 excluded_post_types="post,page"]‘ );

  13. Matthew says:
    February 20, 2013 at 9:01 am

    News from the “right tool for the job” dept. I installed “Advanced Search Widget” rather than try to wrangle this shortcode into a task it was not meant to do. All is well. Thank you.

    Reply
    • Pippin says:
      February 20, 2013 at 5:06 pm

      Ok!

  14. Jason says:
    February 25, 2013 at 9:55 am

    Hi,

    I’m looking for this on code canyon and I can’t seem to see which one it is under. Could you shed some light on this for me?

    Reply
    • Pippin says:
      February 25, 2013 at 11:02 am

      This plugin has never been on Code Canyon. You can purchase it from this page.

  15. Shelby Christiansen says:
    March 26, 2013 at 11:36 am

    Is there a way for this plugin to support nested Taxonomies? I’m doing a site that has the State and City defined via taxonomies and I’ve had a hell of a time finding support for an advanced search form that would allow me to sort through custom post type’s which define the vehicle type, then State and Cities defined in Taxonomies.

    If it would this plugin would be the bee’s knees.

    Reply
    • Pippin says:
      March 26, 2013 at 4:03 pm

      Nested in what way?

    • Shelby Christiansen says:
      March 26, 2013 at 5:12 pm

      Ideally for me there would be the ability to first select the Parent Taxonomy in a separate select box, then the child taxonomy in a separate select box which is populated only with terms matching the parent select box.

      I.E.

      State – Parent Taxonomy
      California
      Nevada

      Cities – Child Taxonomy
      Los Angeles
      Sacramento
      San Francisco

    • Pippin says:
      April 1, 2013 at 4:27 pm

      Sorry for the slow reply, but no, that isn’t possible.

    • Shelby Christiansen says:
      April 2, 2013 at 10:06 am

      I appreciate your time and effort, luckily I found something a little closer to what I was looking for. If anyone else is looking for a similar solution WP-Types.com sells a complete toolset with Parametric search functionality built in.

  16. Shelby Christiansen says:
    April 2, 2013 at 4:52 pm

    One more thing if anyone else is looking, there’s a plugin called AJAX Chained Selects that also can add Chained Select Boxes like I wanted for Categories, and Taxonomies, but unfortunately doesn’t support custom post types.

    Reply
  17. Scot MacDonald says:
    April 17, 2013 at 10:21 am

    Wondering how to exclude everything but the custom post types I’m wanting to search (including removing the “Any” option). I have this below but can’t seem to exclude the “Any” radio button:

    [advanced_search excluded_post_types="post,page,forum,attachment,topic,reply" categories=0 tags=0 taxonomies="locations,programs" style="select" search_tax_text="Choose %s" search_text="Search"]

    Reply
    • Pippin says:
      April 17, 2013 at 7:06 pm

      At this time, the Any option can only be excluded by hiding it with CSS.

  18. nachumi_e says:
    April 22, 2013 at 4:11 am

    is there a way to get posts from different site on network?
    (WordPress Multi Sites)

    Reply
  19. Jaki Levy says:
    April 22, 2013 at 9:08 am

    This download link is also busted for me :-(

    Reply
    • Pippin says:
      April 22, 2013 at 9:10 am

      I’ve just fixed it as well. Something happened on my host over the weekend and a large number of files disappeared. If you encounter any others, give it a few minutes and try again. I’m going through all of them right now.

    • Jaki Levy says:
      April 22, 2013 at 9:34 am

      Thx, Pippin!

  20. Marc says:
    May 9, 2013 at 4:28 am

    Hi
    I need a search box with radio buttons to allow users to search by normal text or tags. Can you plugin do this?

    Thanks.

    Reply
    • Pippin says:
      May 10, 2013 at 4:13 pm

      No, sorry.

  21. Gil says:
    May 11, 2013 at 11:32 am

    Hi Pippin
    please let me know if this advanced search plugin will fit my needs
    see here:
    http://wordpress.stackexchange.com/questions/99119/advanced-wordpress-search-with-drop-down-menus
    if it does I will go ahead and purchase it. I am just not sure if the option of having 2 drop sown menus exists.

    Thanks
    Gil

    Reply
    • Pippin says:
      May 13, 2013 at 9:07 pm

      As long as both drop downs are taxonomies or post types, yes you can!

Comment navigation

← Older Comments

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Login

Lost your password?

Please enter your username or e-mail address. You will receive a new password via e-mail.

  • Facebook Become a Fan Like

  • Twitter Subscribe on Twitter Follow

  • YouTube Follow my Videos Subscribe

  • RSS Feed Subscribe with RSS Subscribe

Easy Digital Downloads

Most Loved

  • Love It Pro for WordPress
  • Write a “Love It” Plugin with Ajax to Let Users Love Their Favorite Posts / Pages
  • Simple Notices Pro Plugin for WordPress
  • User Bookmarks for WordPress
  • Front End Registration and Login Forms Plugin

Similar Plugins and Posts

  • Build a Search Logging Plugin
  • Create a Live Search in WordPress with jQuery and Ajax

Latest Premium Content

  • Plugin Development 101 – Introduction to Adding Dashboard Menus
  • Plugin Development 101 – Intro to Loading Scripts and Styles
  • User Follow System – Part 5
  • Plugin Development 101 – Intro to Short Codes
  • Plugin Development 101 – Registering a Custom Post Type
  • Plugin Development 101 – Intro to Actions

Latest Tutorials

  • Submitting Your First Pull Request to a WordPress Plugin on Github (1)

    Github is an extremely popular tool for managing WordPress plugins, and one...

  • Plugin Development 101 – Introduction to Adding Dashboard Menus (1)

    Adding new menus, both top level and sub level, to the WordPress Dashboard is a really common task for plugins...

  • Plugin Development 101 – Intro to Loading Scripts and Styles (16)

    In this part of Plugin...

Enter your email to receive automated updates when new posts are published

Latest Tweets

  • @Rarst A whole lot of this: http://t.co/V81OP87Orl
    May 20, 2013
  • @Rarst lol, that&#039;s about half of the cars where I live
    May 20, 2013
  • @markmcwilliams happy birthday!
    May 20, 2013

Topics

the_content Sugar Event Calendar featured register_setting contextual help attachments add_options_page hook meta box Tom McFarlin wp_enqueue_script Rémi Corson get_user_meta plugin login do_action image mail chimp forms authors short codes attachment Related posts apply_filters bbpress recent posts comments post types taxonomies short code custom post type gallery Ajax images Stripe taxonomy jquery users widgets add_filter easy content types add_action widget restrict content pro easy digital downloads

Weekly Newsletter

Useful Links

  • Join the Site
  • Plugin Store
  • Affiliate Area
  • Tag Index
  • Support the Site
  • Suggest a Tutorial
  • Random Post
  • Contact

Monthly Archives

(c) 2011 Pippin's Plugins