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();
}