Display condition based on URL

Hello,

It would be great to have a display condtion for a block / section / div / element where an item can be shown or hidden based on if the URL contains a certain phrase.

For example, if the URL or URL parameter contains the phrase ‘summer’ I would like to show a block - [mysite.com/somepage?offer=summer](http://mysite.com/somepage?offer=summer

Screenshot 2023-02-26 at 08.28.04

1 Like

Hi @mikekellner,
welcome to the forum. :tada:
This sounds interesting. Could you give a use case example for when this would be used?
I use ACF fields to filter. So I don’t really know in which scenario I have a special URL :thinking:

Hi @T-low, thank you for your reply.

An example would be that we might send a link in our email newsletter to show an offer as part of a product page only to those who have a link with the offer parameter as mentioned above.

Another example is that using Elementor and an extension for it, we were also able to add support notes in different areas of the WooCommerce My Account page area, based on the endpoints. So somebody who navigates to /my-account/payment-methods would be see some support notes on how to update or add a new payment card.

1 Like

If memory serves, Louis mentioned in one of the query walkthroughs (I believe when the query block was introduced or thereabouts) about taking/querying data from url string. I can’t remember exactly which video it was, but that might be a good place for you to start.

Hi @mikekellner,

Welcome to the forum :slight_smile:

Thanks for the suggestion! I’ll try and get this included in the next update :+1:

4 Likes

Thank you so much @Louis :slight_smile:

1 Like