Styles in Custom Element Stopped Working After Updating to Pro 5.0.8

Hey guys!

I have created some custom elements based on the guide here.

Early last year though around January when an update was released, the CSS in those custom elements stopped working. Another user posted about this issue here which solved the issue which is to simply change $mod_id to $style_id.

I have just updated to Pro 5.0.8 and I am having the same issues again where the dynamic CSS that are in the style function I have are not getting applied to the custom element again.

Is there anything that I need to change in the code again? I tried checking the core elements to see how they are coded now but I am unsure about the best way to update my code that will reflect the new changes in the Element API (if there are any).

Thank you.


Here are some snippets I have in my code:

// Define Element
// =============================================================================

$data = array(
    'title'     => __( 'Custom Element', '__ce__' ),
    'values'    => $values,
    'builder'   => 'builder_setup_custom_element',
    'style'     => 'style_custom_element',
    'render'    => 'render_custom_element',
);

// Register Module
// =============================================================================

cs_register_element( 'custom-element', $data );

// Style
// =============================================================================

function style_custom_element() {

    ob_start();

    ?>

    .$_el.custom-element svg {
        width: $icon_size;
    }

    .$_el.custom-element.encircle {
        width: $container_size;
       height: $container_size;
    }

    .$_el.custom-element .text-link {
        font-size: $font_size;
        letter-spacing: $letter_spacing;
    }

    <?php return ob_get_clean();

}

Hi @jadealombro,

Hope you’re doing well! I’m sorry, this did break with Pro 5.0. The documentation and sample element are no longer accurate. We need to get that corrected. To make way for responsive styling we build a whole new generated CSS system. The previous one (used in custom elements) has been removed entirely, which is why your styles are not added.

Unfortunately I don’t have a solution for this at the moment. Our approach to custom elements is going to shift with the Theme Options reboot. We are going to build a system that will allow you to create custom elements in Cornerstone directly by composing several smaller elements together and creating a mapping of controls. It’s very early to elaborate on this, but the goal is to replace the need for custom elements at a PHP level.

I wish I had better news about this. For now, I would recommend staying on Pro 4 if you need those elements until we can find a solution to migrate them to the new system.