Redux Framework creating a Protocol Relative URL Filter

I’m working on a WP Theme that uses Redux Framework and I am trying to create a filter for fields that have a URL attached to them, ie, Background Fields, Media Fields, so that I can make them Protocol relative and able to use SSL site-wide without conflicts.

So far I have the following function in my options-init.php file for a Background Field but to be honest I have very little experience with Filters, and the documentation for Redux Framework is very vague.

Read More

Field is as follows:

 array(
            'id'       => 'front-background',
            'type'     => 'background',
            'url'      => true,
            'title'    => __('Front Page Background', 'blanque'),
            'desc'     => __('Background image for Front Page', 'blanque'),
            'subtitle' => __('', 'blanque'),
            'compiler' => true,
            'output'   => array(
                    'background' => 'body.home',
                ),
            'default'  => array(
                'url' => '',
                ),
            'background-color' => false,
            'preview_height'   => '100px',
        )

Fuction to filter output:

function the_theme_redux_filters($url) {
        $relativeURL = str_replace(array('http://','https://'), '//', $url);
        return $relativeURL;
    }
add_filter( 'redux/validate/front-background/class/{field.validate}', '', 10, 1 );

Would someone be able to give me a clue as to what I should actually be doing please?

Related posts

Leave a Reply