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.
![](https://wpdevdesign.com/wp-content/uploads/2021/09/url-has-string-oxygen-condition-1024x188.png)
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
Code:
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.