Displaying Your Routes on the Frontend
Once you have configured the plugin and added some routes, you need to display the filter and results on a page on your website. There are two methods to do this: using Gutenberg Blocks (recommended) or using Shortcodes.
Method 1: Gutenberg Blocks (Recommended)
If you are using the modern WordPress Block Editor (Gutenberg), this is the easiest and most visual way to set up your route filtering page.
- Create a new Page in WordPress (or edit an existing one).
- Click the 'Add Block' button (the '+' icon) to open the block library.
- Search for "Route Finder" or scroll to the "Route Finder" category.
-
You will see two available blocks:
- Route Filter Form: This block displays the interactive filter controls (sliders, dropdowns, etc.).
- Route Filter Results: This block displays the list of routes that match the user's filter criteria.
- Add the Route Filter Form block to your page content.
- Add the Route Filter Results block to the same page, usually directly below the form.
- Save the page. That's it! The plugin will handle the communication between the form and the results block automatically.
In the editor, it will look something like this:
Method 2: Shortcodes
If you are using the Classic WordPress Editor, or need to place the filters inside another plugin or page builder, you can use shortcodes.
- Create a new Page in WordPress (or edit an existing one).
-
In the text editor, you will need to add two shortcodes:
[route_filter_form]: This will display the filter form.[rfcc_filter_results]: This will display the results.
- Place these shortcodes one after the other in the page content.
- Save the page.
Your page content should look like this:
[route_filter_form]
[rfcc_filter_results]
Important: For the filtering to work correctly, both the form and the results (either as blocks or shortcodes) must be present on the same page.