Content of the page

Using search shortcode

Content of the article

MDTF search shortcode is the second main feature in the plugins functionality after MDTF widget. It is very flexible feature which you can insert not only in the sidebar but in any place of your site. Shortcodes of the plugin you can find here: 

Lets go into one of them and lets consider its options:

  • Select filter category - here as in the widget you have to select filter-category which you want to use in the search form. If you want to use taxonomies only leave it empty and check checkbox 'Taxomies only in filter'
  • Ignore filter-category in wp_query - use this checkbox when you want just make searching by title or content OR by taxonomies only. That is mean that you already created filter-category and added there textinput (by title/content). Here is some examples by title and  by content
  • Taxonomies only in filter - check it if you are going to use taxonomies only in the search form of current shortcode.
  • Results output page link - Write there any link to any pages by your logic OR leave it empty and this options will be taken from the plugins settings. Set magic word 'self' if you want make searching on the same page.
  • Results output template - Write there any template file name OR leave it empty and this options will be taken from the plugins settings (Output search template).  Use magic word 'self' if you are making searching on the same page.
  • Custom text for search results - example: Found <span>%s</span> items
  • Custom reset link- set link to where redirect a customer after pressing 'Reset' button on the front. Use magic word 'self' if you are making searching on the same page.
  • Auto submit - if you check this option the search will start instantly after user changes (select, check) something on the search form
  • AJAX Auto recount - recounts search form combinations for each filter-item
  • AJAX items output - uses in pair with 'AJAX Auto recount' only. Means that you can output posts using AJAX. Works from the box for woocommerce, for another tasks its nessesary to use special shortcode [mdf_results_by_ajax]
  • Show count - show count of variations which can be found near each html-item
  • Hide items where count of items is 0 - hide filter-items which has zero variations
  • Show reset button - if you need you can set reset button for your customers. Very convenient thing for your customers, better check it
  • Show found items count text - shows 'Custom text for search results' if checked
  • Filter button text - text which is displayed on the filter button
  • Post type - 'slug' of post type which posts you are going to filter
  • Taxonomies options - here you can select taxonomies you want to display in the filter
    • checkbox - check it if you want use this taxonomy in the shortcode search form
    • first text input - custom title for taxonomy on front.
    • second text input - if you want to display taxonomies terms as checkboxes, maybe you will need set max-height for them in search form
    • first drop-down - how to display current taxonomy on the front
    • second drop-down - is for 'drop-down' mode selected in 'first drop-down' when you want to show taxonomies parents and its childs terms as on screen:  . To give different names to parent and its childs in the  first textinput write smth like this: Country^City^Suburb
  • Additional taxonomies conditions - this is the special feature in the widget if you want to set taxonomies conditions in the search form. For example you want on one page make searching of products which belongs to product_cat with term ID 96, and the filter should show count of combinations of all positions relatively to this term ID 96. You should write there next expression: product_cat=96. For more terms write condition using comma: product_cat=96,3. If you want to use more taxonomies in the same condition write something like this: product_cat=96,3^boutiques=77,88 - using special sign '^' (SHIFT+6 in Windows). If its uses with shortcode [mdf_custom] or [mdf_products]  the same conditions should be set there too for synchronizing
  • Sort panel - Allows you to make sorting in the search results. Read more here about it
  • Shortcode front skin - select predefined shortcode skin OR you can customize shortcode css. Read this article for more please

 


 

How to use

You can insert filter by shortcode in any content part of any page or in any php files of your current wp theme: 

Here is some examples how you can use shortcodes: