Filter blog posts based on url parameters

I’m trying to create a redirect page for a form. Im using gravity forms and on that redirect page I would like to show different content based on someones selection for a checkbox group. So, if they click on a checkbox and after the hit submit, they would be redirected to another page that would show blogs based around the checkbox. I know I can pass a query string from the form submission to the page, but I don’t know how to display blogs based on the url parameters. I know you can hide/show content based on a url parameter by editing the child theme, but I was hoping to find a way to filter blog posts by the url parameter.

I’m working on something similar and perhaps if I share my thinking it’ll trigger some ideas for you.

If you open up your advanced tab on your posts module, you’ll see conditional logic area. In that section, there is an option for URL variable. Gravity Forms calls this query string as you’ve noted.

While I haven’t gotten it to work yet for my own purposes, it seems that it would work in theory the following way:

URL Variable [variable from gravity forms between ?/& and =] equals [whatever follows equal sign in the URL]

So if your gravity form had a field called Select Color and you had three checkboxes, Red, Blue & Green. If all three checkboxes were selected & you’re passing that data in the confirmation settings correctly… the url would get the following query string added (or something close)

?red=red&blue=blue&green=green

If only red and blue were selected
?red=red&blue=blue&green=

If only red and green
?red=red&blue=&green=green

So… theoretically, your posts related to red would be conditionally formatted like so:

URL Variable [red] equals [red]

I’ve figured out what I was doing wrong and it was largely on the GF side but it also had an implication on the BB conditional side as well. I’ll explain both below.

GF side
When you setup your query string data syntax, do this:
establish a simple id to insert into the URL and follow it with your GF merge tag {Field Title:field #} something like {Choose Color:12} whereas you have a checkbox labeled ‘Choose Color’ and it happens to be field ID 12 .

For a checkbox labelled ‘Product Interest’, field ID #10 with three products it might look like this in the GF settings.

What’s written before the = sign is up to you and non-consequential. It could be anything that works for you. What’s written after the = sign is up to Gravity Forms based on your options & the selections of the user filling the form.

If all three products are selected, the URL would get the following additions
/?product=ProductOne,ProductTwo,ProductThree

You should test your form and see what your selections produce as a query string.

Here is the implication on the BB conditional side
If the user can select more than one option, choose ‘contains’ instead of ‘equals’ … it’s easier to look for keywords within the result than to contruct all the exact syntax.

The display conditional would read something like
URL Variable product contains One

If product One was selected, it would appear in the string in the URL, thus qualifying the conditional and showing the module accordingly.

Mine is all working now. Try it for yourself, best of luck.