12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Sep 29, 2021

[Condition] URL Has String

Sridhar Katakam

A reader asked via email:

Do you know how to use conditional logic for urls. not: ?country=uk , but: mydomain.com/uk/pricelist/

This members-only tutorial provides the steps to register a custom condition for Oxygen using which elements can be set to be output only if the URL of current page being viewed has the specified string in it.

With the condition in place, to make an element be output on say, mydomain.com/uk/pricelist/ you simply add the "URL Has String" condition and type uk in the condition's input. The element will then be printed only on pages with matching URLs like /uk/, /uk/pricelist/.

Besides the default == operator, != is also provided.

Step 1

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: [Condition] URL Has String


This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.