Content of the article
Built-in meta data constructor is necessary for creating different types of html-items in the MDTF search form which realizes filtering by meta-data. Thanks to this constructor you can create for example such search forms: You can create next types of meta fields with the constructor (filter-items):
- label (From v.2.2.2/1.2.2)
- range slider
- range select (From v.2.2.2/1.2.2)
- search by author (From v.2.2.2/1.2.2)
- taxonomy - means only place where taxonomies selected in widget/shortcode will be appeared
The most simple element of the constructor. Has 2 values only: 1 OR 0.
- Item name - any word you want to see there
- Item description - description of this element for your customers. Displayed as tool tip icon . The same for another elements described below.
- Item meta key - by default its generated for example as medafi_544131696a66b. But if you want something more beauty you can in any time change its key name as on the previous screen - medafi_summer. The key must be beginning from 'medafi_' prefix. The same for another elements described below.
- Reflect value from meta key - very power feature, reflecting value from another meta key while search is going. Look description about the range-slider below!
Drop-down filter item
- Very convenient item when you have list of options and you do not want or not able to create new taxonomies. Just look on the next screen:
- Keys in drop-down in meta constructor can be with spaces, any format you want for more easy compatibility with ACF
- Drop-down size - the size of drop-down as html item on the site front
- Drop-down first option title - word which is displayed if nothing selected
- Prepend drop-down option - add drop-down option on the top
- Append drop-down option- add drop-down option on the bottom. By the way options are draggable
- Search inside range - power feature when you want to use drop-down for searching in decimal ranges.
- create drop-down options like: 0-500, 501-1000, 1001- i ...
- i - means infinity
- in each post set value on its backend
- that is all 😉 Now on the front you can see drop-down range filter:
- Sort options by alphabetical order - you can enable it to show on front options sorted by alphabet
Range-slider filter item
- Range-slider allows you to work with integer and float data. You can set such ranges as from 0 to 1000, so and such range as from 0.1 to 1.5 with the step you need, + you can set any prefixes and postfixes:
- From^To - min and max value with which the range slider is works. Set it thought sign '^' (SHIFT+6 in the Windows). Example: 0^1000
- Slider step - you can set any step you want. For example if your range is from 0 to 100000 will be good set step as 1000 for your customers (for example: miles)...
- Prefix - sign or word on the front before max/min value
- Postfix - sign or word on the front after max/min value
- Prettify - set it 'Yes' for prices values for example, and price will be displayed as 1 000 000, another way as 1000000. For years set 'No', another way years will be displayed for example as 2 014 instead of 2014
- Search inside range - special mode which allows you to set in the post backend range - 2 values range and on the site front single range-slider will be searching posts which range satisfy to number selected by this range slider This works in such way: you set for example on any post backend values from 20 to 50. So when you set on the site front range-slider value to 40 - that post will be found, BUT if you will set by range-slider 70 for example - that post will not be found. Very useful tool when your posts belongs to range 'from .. to' and you want to provide searching of it.
- This is woo price, and I want to set range from min price to max price from database - the name says for itself, this feature do not look on 'From^To' and set 'From' as min price in the shop, and 'To' as the max price in the shop.
- Reflect value from meta key - very useful feature in the plugins functionality. For example, you have a lot of products already with prices. You installed the plugin and created range slider for products prices. But for the WordPress it is just a new meta key which doesn know about your already existed prices! So what to do? Filter cant work because data for new meta key doesn exists. MDTF has decision for this task - reflect value of already existed prices meta_key. Just check the checkbox on the left and drop woocommerce price meta-key in the textinput near (for woocommerce it is _price) and that is all.
Attention: reflection works with meta data only and NOT with taxonomies!
Textinput filter item
- You can use this item for searching by text, for example by words in the post title or its content:
- Here is 5 mode for searching by text: self, post title, post content, post title OR content, post title AND content
- In the text field on the screen you can type any word you want and it will be displayed for your customers on the site front as placeholder:
- For searching by title you are need to select from the first right drop-down 'post title'. For searching by words of current textinput select 'self' but you will have to set text data to this textinput in each post backend. So do it by your own logic.
- Second drop down define how to search - 'like' or the 'exact'. Better use 'like', but maybe you will need searching by exact text information, for example books IBAN.
- Third drop-down is good when you want to display on the backend not textinput but textarea for your convinience (good for self searching mode).
Calendar filter item
- Calendar allows you to filter data using date range and has no options:
- One thing is only you will need for calendar is date format, which you can set in the plugins settings:
- This filter-item data is NOT reflect-able and doesn compatible with ACF
- Map item creates on the backend of the posts place where you can set latitude and longitude data and description for posts pin on the map This data is necessary when you want to display search results and show them on the Google map too. You need apply shortcode for this [mdf_gmap height="300" width="100" zoom="11" maptype="TERRAIN" metakey="medafi_map"] where 'medafi_map' is meta key of the map item in the meta-constructor. You can apply map in any search template for example Map is shown only when the search is going! You can look this demo page - just select any country on the top of the filter.
Search by author
Displays drop-down on the front and allows users filter posts/custom post types by their author. Doesn work with Statistic!
Taxonomy filter item
- This is special type, means only the place where will be displayed taxonomies on the front selected in widget/shortcode. Has no options at all. It is only place mark and nothing more. Taxonomy filter-item must be ONE (UNIQUE) in the same filter-category filter set. SHORTLY: Do not use it twice in the same SEARCH FORM!!
Another features/options of the filter-section
- Filter sequence on front - Sequence of how to display filters-sections on the site front. It is very convenient set them via ajax as on the screen:
- The section max-height - max height of the current filter-section on the front. 0 by default means infinity. For example you have 20 checkboxes in the current filter-section, so if you not set max-height your filter-section will be veeeeery long and not convenient for your customers. Just set 300 for example and you will get more short filter on the front with beauty scroll which you can enable in the plugins settings Works only for widgets! Backend height option is for convenient work in the post backend only where there is a lot of elements in the current filter-section.
- The section toggle - allows you to hide and show current filter-section closed or opened on the front. Signs/words for the toggle button on the front you can set in the plugins settings here:
Works only for widgets!
- MDTF Categories - Filter-section must have selected minimum 1 filter-category by logic. They should be created here
- Show as multiple checkbox select - convenient feature when current section has checkboxes only and you want to display it on the front of the site as multi-drop-down. ONLY for current section with checkboxes. Not for taxonomies ... Its conception was taken from here: http://codepen.io/elmahdim/pen/hlmri