Hi, I have been using plugin called Code Snippet to register for example custom conditions for Oxygen builder. One of those conditions are browser languages.

For that I use:

if( function_exists(‘oxygen_vsb_register_condition’) ) {
global $oxy_condition_operators;
    oxygen_vsb_register_condition(
        ‘Browser Language’,
        array(‘options’=>array(‘sv’, ‘en’), ‘custom’=>false),
        $oxy_condition_operators[‘int’] = array(‘==’, ‘!=’),
        ‘my_browser_language’,
        ‘Other’
    );
function my_browser_language( $value, $operator ) {
    $theLanguage = substr($_SERVER[‘HTTP_ACCEPT_LANGUAGE’], 0, 2);
    $is_language = ($theLanguage == $value);
        if ($operator == ‘==’) return $is_language;
    return !$is_language;
    }
}
This works fine using plugin Code Snippets.

However, if I take the some code and copy/paste it to your plugins code blocks, it doesn’t register the condition. I use Everywhere as the trigger location and wrap the code in <?php ?> tags.

BUT, if I use:

Trigger location > Conditions
Scripts location > PHP

Template > All,
It works… Can you explain this?

2 responses to “Trigger location Everywhere does not work!”

  1. cmsexpertss says:

    Hi,

    Thank you for contacting us.

    Regarding your question that it works if you set it to Everywhere then it doesn’t work, basically some hooks need to be initiated on “init” action of WordPress and some are after “plugins_loaded” etc, so that’s why every hook needs to be checked where it will work best as the Oxygen hooks you are trying to override maybe using the hook which initiates later so when you set your code to run “Everywhere” then oxygen overrides your hook.

    I hope this helps.

    Regards,
    Muhammad Osama

  2. cmsexpertss says:

    Hi,

    I am closing ticket as there is no reply. Please open a new ticket if you see any issue.

    Regards,
    Muhammad Osama

Leave a Reply

Your email address will not be published.