Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1328330

    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?

    #1328355

    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

    #1328362

    That works perfectly, thanks Mike.

    #1328364

    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

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Add class to code block parent section container’ is closed to new replies.