Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #29215

    I really like the Avia advanced editor but am having trouble using it to just insert “code” (HTML, PHP, CSS, etc.). I am trying to use a Text Block (the closest element I found to something plain that might allow me to avoid unnecessary code). I want to use the Text Block for alignment and layout purposes in relation to the rest of the elements on the page, but want to use my own divs, spans, etc. to control styling and content. Does that make sense? I am finding, however, that p tags are added around anything I put inside a text box.

    Is there any easier way to add my own elements and code, while still preserving the location relative to the rest of the content elements? Ideally I think I’m looking for just a Code Content Element.



    No, the Avia advanced editor does not support php code, etc. snippets. You can use plugins like: or to insert them with shortcodes.

    Although I can understand that such an element would be useful for developers it’s imo a big security risk to allow the user to add executable php code to a template. He could use this element to hack your database, files, etc.


    Thank you for the reply. Is there a way then to allow just HTML and CSS without having the element wrapped in a <p> tag? (all text blocks seem to be wrapped in a <p> tag even if I don’t put one into the field itself.



    If you’re using the Text Block element, you can edit config-templatebuilder > avia-shortcodes > textblock.php. Find this code:

    return "<div class='avia_textblock {$custom_class}'>".ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content) )."</div>";

    Replace it with:

    return "<div class='avia_textblock {$custom_class}'>".ShortcodeHelper::avia_remove_autop($content,true)."</div>";

    And this code:

    $params['innerHtml'] = "<div class='avia_textblock avia_textblock_style' data-update_with='content'>".stripslashes(wpautop(trim(html_entity_decode( $params['content']) )))."</div>";

    Replace with:

    $params['innerHtml'] = "<div class='avia_textblock avia_textblock_style' data-update_with='content'>".stripslashes(trim(html_entity_decode( $params['content']) ))."</div>";

    Please remove browser cache then reload the page a few times.




    Thanks for the reply Ismael. I made the change and cleared my cache, but nothing seems to have changed. What is does the code you provided do, exactly?



    Hi Dan,

    The code above removes the WordPress function which adds the paragraph tags to the content. You may need to re-create the text element to see the change live.




    Thanks Devin, recreating the text element seemed to do it.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Adding just "code" with Avia advanced editor’ is closed to new replies.