Cs_register_element style callback not triggered

Hi!

I’m developping a custom element using the documentation and I’ve encountered an issue. I created a function that should generate some simple Css, but it seems like the callback refuses to trigger. All the other callback are working as intented except the style one. I even tried calling die() in the function just to see if it was called at all and it seems like it’s not.

Here is the relevant code:

// Register "My Element"
cs_register_element('centris-filter', array(
'title'   => __('Filtre Centris', 'mw-centris'),
'values'  => $values,
'builder' => 'mw_centris_filter_builder',
'style'   => 'mw_centris_style',
'render'  => 'mw_centris_filter_render'
));

function mw_centris_style() {
ob_start();
?>
    .centris-property-filter{
        background-color: black !important;
        content: 'test-tag'
    }
<?php
return ob_get_clean();
}

Try adding in the following filter so your style isn’t cached, and so you can freely edit the style as your create your plugin. You might also run into an issue with the SG cache on your site. If you are targeting a singular class, you might find it’s simpler to just enqueue a style sheet. I was not able to edit the plugin on that site to test some things. Let me know if that helps.

add_filter('cs_disable_style_cache', '__return_true');

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.