Hi.
I have various blog pages with a different bird name in each URL.
I would like to display the same view on each page, but the view set up to display a matching form entry for that specific blog (eg: the 'eagle' form entry is displayed only when 'eagle' appears in the blog post URL).
Is this even possible? Or would I be better creating a different view for each bird species, or using shortcodes?
TIA
You can do this with a single view filtered on bird species. You pass the parameter in the URL: my-view.com?species=eagle. In your view filter you set species to equal [get param='species']
Thanks! I'm not very familiar with get param.
When you refer to the URL 'my-view.com?species=eagle'?, do you mean the URL of the blog post?
Eg: https://arcguiding.com/blog/nature/scottish-crossbill/
I get roughly how the filtering is set up, but not the previous part: how to pass the parameter. This doesn't mean changing the corresponding blog post URL does it?
Thanks for your patience.
You asked about how to filter a view. I already told you, views have nothing to do with blog posts.
I think you some miscommunication here, so I'll give it a shot. What I think you're asking for is a way to parse the URL (not the parameters) and use the result to filter a view. There are two ways I can think of to do that, the first will definitely work though it's big-time custom and the second I assume will work. The first is to make the content of your view a shortcode and the shortcode parses the URL, figures out which bird type, and then returns the HTML needed to generate the output. The second is to use frm_where_filter. You set up your view however you want and use that hook to set the bird parameter based on the URL.
Hey thanks Rob for your help. It's all fixed now, super simple. I'm no expert - I was trying with the Gutenberg Formidable Views block and hadn't understood that the value could be passed via the shortcode instead. All fixed now, thanks 😁 (also ran into a big ol bug cos using an old version of the plugin)
Please login or Register to submit your answer