MDTF has in-built constructor for the sort panels. This feature you can find here:
Look on this page please to see sort-panel in the action:
It is very easy to create such sort panel:
- Press "Add new sort panel"
- Enter title of it
- Select it "Panel Type" - drop-down or buttons
- If you want to show near the sort-panel all taxonomies which are in the current MDTF search query - click checkbox 'Show results taxonomies navigation'
- Press button 'Add meta key'
- Enter any special word using next syntax: title^Title - where "title" is a special word, and "Title" is a text label
- Special words: ID,author,title,name,date,modified,rand,comment_count,menu_order.
- Also its possible to use any meta keys as a special word, but they should keep decimal or integer values in the posts where they are applied. For example you want to sort by woocommerce price in your shop (this is just an example related to woocommerce, sort-panel works for any custom meta keys with decimal values in its posts) - products price contains in the meta field with key "_price", so add new text input by 'Add meta key' button and write there: _price^Price - where 'Price' is a text label on the site front
Using:
- You can use sort-panel in MDTF widgets and MDTF shortcode [mdf_search_form]
- In the widgets you should select it here:
- In shortcodes you should select it here:
- And of course you can use sort-panel in the custom templates using MDTF_SORT_PANEL::mdtf_catalog_ordering();
- Use shortcode [mdf_sort_panel] in the usual text-widget OR in the post text editor to display sort-panel
- Only in WooCommerce sort-panel displays automatically. For all another cases it should be added by shortcode [mdf_sort_panel]. Or by PHP function MDTF_SORT_PANEL::mdtf_catalog_ordering(); somewhere in the code of output file of MDTF template