1. Home
  2. ReHub Theme
  3. Directory functions, advanced specifications
  4. Setting widget and forms for filter

Setting widget and forms for filter

Now, you need to understand logic of plugin. You have 2 parts for filtering. First part is widget or shortcode form with all filters, second part is post results. Both parts must be configured properly. For first time, you can have panic, because of so many settings. Don’t worry, in most cases, all things must be as default and you need to change only 3-4 fields.

Work with widgets

The plugin has 2 widget for filters: MDTF and MDTF Taxonomies only. We need first when we are going to filter post by meta data. If you want to filter posts only by category or other taxonomy – use Taxonomy only widget. So, let’s consider first widget. If you are planning to use second widget read this instructions too, it is useful for understanding some moments.

Drop the widget in sidebar, write title, select filter-category we are going to filter with.

Next, very important things:

 

Results output page link– this is a page URL where user will see results of filtered content. If you want to show results on the same page – add word “self” there. If you have widget on one page, but want to show results on other page – add direct url of page in this field. Output results page must have post module which is synchronized with MDTF plugin. In Rehub theme, almost all post modules can be used for MDTF. Check how to create output page in next article

Results output template is a template file of theme which is used for results display. In 99%, you need to set word “self” in this field.

Reset link – is link where user will be redirected after clicking on reset button. I recommend to set the same url as Results output page link:

Taxonomy settings of widget

Taxonomy is default logic in wordpress which is used for categories, tags, etc You can enable them also in filters.

Lets consider taxonomy options when you are pressing Options button. You can select here how the taxonomy will appears on the front: checkbox or drop-down. You can select title for first option of the taxonomy if it is drop-down, select which terms to hide if you are not want to show them:

One secret! Imagine that you have taxonomy Locations, and want to show this as: Countries, Regions, Cities – parent,child,child – and each has its own title of first option. It simple, just write in textinput Custom name/title for taxonomies: Countries^Regions^Cities. You will get something like this

If you selected the taxonomy view as checkboxes, another option will be appeared – Block max height. If you have, for example, 300 terms and such high box can break your layout on front. If you set this max height -scroll bar will appear if block takes more than 300 px.

Note: If you want to have search sidebar on all pages of site – drop it in sidebar area. If you want to have search filters in sidebar only for one separate page – drop widget in MDTF sidebar area, create new page and choose “MDTF output page” in page attributes. MDTF sidebar area will be visible only on this page.
Tip: By default, sidebar area is visible under posts on mobiles, you can try to use Slidebar plugin to insert widget in sliding panel 

How to add filter widget only on some pages

Use for this plugin Woosidebar which bundled in theme. Also I recommend you do not use plugin custom sidebars for this purpose.

Adding form by shortcode

Another way to show filters on site is shortcode form.

Adding filter form by shortcode has very similar logic, but more customizable.

First difference, that you can choose what fields to include to form.

Also, you can choose taxonomy.

Second difference – you can use shortcodes in any place of site: in text widgets and in content of page.

Third difference – skins, you can select how your shortcode will appear on front:

I created some skins for you.

Default and dark – is shortcodes by default. It has 3 column and button in the end.

Defaultfullwidth and darkfullwidth – is form that you can use with full width layout. It has 4 column. Use such shortcode only in page content.

Also, I create darkmobile and defaultmobile shortcodes. What do they mean? As you know, mobiles has small resolution, so website has only one column on mobiles. Sidebar is displayed at bottom of page, and when you add filter widget to sidebar it will be visible under all content. So, if you want to show filter form also before search results (but only on mobiles), choose this layout.

After saving shortcode, copy code and paste in any page where you want to see form

Also, you can use shortcode styles darksidebar and whitesidebar for using shortcodes in sidebar text widget. Why do you need them if you have MDTF widget? Because filter form by shortcode have a good and useful function – you can hide any field or group of fields.

 

Was this article helpful to you? Yes No

How can we help?