Filters

Normaliser

A normaliser makes different browsers render a website's CSS consistently, by providing a standard set of CSS rules that are compatible with all browsers. This ensures that the layout and styling of a website looks the same across different browsers and devices, by resetting and normalising the default styles applied by the browser.

If you want to provide your own normaliser for the frontend, use the following snippet:

add_filter('cc_normaliser_frontend', function ($arguments) {
    $normaliser_frontend = wp_upload_dir()['baseurl'] . '/custom/normaliser.css';
    return $normaliser_frontend;
});

If you want to provide your own normaliser for the editor, use the following snippet:

add_filter('cc_normaliser_editor', function ($arguments) {
    $normaliser_editor = wp_upload_dir()['basedir'] . '/custom/normaliser-editor.css';
    return $normaliser_editor;
});

Query args

The query args filter allows you to modify the query arguments before they are processed in the Query block.

add_filter( 'cwicly/query/args', function( $query_args, $attributes, $id ) {
    // Change the post_type to location if the user is logged in
    if ($id === 'query-c0d6112' && is_user_logged_in()) {
        $query_args['post_type'] = array('location');
    }

    return $query_args;
}, 10, 3 );

The filter accepts three arguments:

  1. $query_args: an associative array containing the dissected $query: an array of the query variables and their respective values.

  2. $attributes: an associative array containing all set and unset attributes on the specific Query block

  3. $id: a string reference to the Query block ID

Frontend Rendering: shortcode whitelist

The shortcode whitelist filter allows you to specify the shortcodes that you consider safe to run when using Frontend Rendering with Cwicly blocks.

The filter accepts one argument:

  1. $array: an empty index array

Custom Code Priority

The custom code priority constant allows you to specify the priority with which the Cwicly Custom Code snippets are loaded. This is useful in the eventuality you want to load custom snippets before/after specific items.

Simply define CC_CUSTOM_CODE_PRIORITY constant in your wp-config.php file to the desired value.

Custom Classes Column

You can add a list of custom classes to the Class Selector within its own column. The filter's main use if for plugin developers who wish to integrate their framework classes inside Cwicly without having to manually modify different database tables.

Custom Global Colours

The custom global colour filter allows you to add a global colour custom folder containing externally defined colours. These colours will be available within the Cwicly colour picker.

By default, Nav Menu block classes are positionned in their relative <li> items with the current class when available. If you prefer to apply the classes to the <a> item directly, use the following snippet to modify the behaviour.

PHP code permission

Filter the Code block PHP permissions programatically, allowing you to globally or more precisely enable/disable PHP editing and saving in the Code block..

JS code permission

Filter the Code block JS permissions programatically, allowing you to globally or more precisely enable/disable JS editing and saving in the Code block..

PHP code execution

Filter the Code block PHP execution permissions programatically, allowing you to globally or more precisely enable/disable PHP code execution in the Code block.

WPML original stylesheet

Do not load the original translated post stylesheet and load the current translated post stylesheet instead.

Last updated

Was this helpful?