URL Condition for Oxygen

The URL Condition for Oxygen CodeBitt adds a new Oxygen Condition under the “Other” category to hide/show content based on the current URL.

Parameters

$value

(string) The text that you would like to compare against the current URL.

$operator

(operator) Select the operator to determine how to compare the $value to the current URL.

Options:

  • == : Looks for an exact match between the current URL and the $value
  • != : Looks for anything but an exact match between the current URL and the $value
  • contains : Looks for the $value anywhere inside the current URL
  • does not contain : Looks for the $value to not be within the current URL.

function Code

<?php

if (function_exists('oxygen_vsb_register_condition')) {

    global $oxy_condition_operators;

    oxygen_vsb_register_condition('URL', array('options' => array(), 'custom' => true), $oxy_condition_operators['string'], 'bitt_oxygen_url_callback', 'Other');

    function bitt_oxygen_url_callback($value, $operator)
    {

        $url = $_SERVER['REQUEST_URI'];

        return oxy_condition_eval_string($url, $value, $operator);
    }
}
Leave a Reply

Your email address will not be published. Required fields are marked *

    Table Of Contents

    Related Content

    © 2020-2024 Luxibay
    Name(Required)
    Please let us know what's on your mind. Have a question for us? Ask away.
    This field is for validation purposes and should be left unchanged.