Tagged: CSS
Hi,
When I create a code block element with a custom class “break”, it creates the following code:
<section class="avia_codeblock_section avia_code_block_3" itemscope="itemscope" itemtype="https://schema.org/CreativeWork">
<div class="avia_codeblock break" itemprop="text">
<div></div>
</div>
</section>
I need the custom class “break” to be applied to the outermost element, which in this case would be the section element. Is there a way to achieve this please?
Hey aestheticare,
Try adding this code to the end of your functions.php file in Appearance ▸ Editor:
function move_codeblock_class_to_parent() { ?>
<script>
(function($){
$('.avia_codeblock.break').each(function() {
$(this).removeClass('break').parent().addClass('break');
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'move_codeblock_class_to_parent');
it will search for code blocks with the class “break” and move the class to the parent div.
Best regards,
Mike
That works perfectly, thanks Mike.
Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.
Best regards,
Mike