-
AuthorPosts
-
September 7, 2013 at 7:44 pm #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.
-Dan
September 9, 2013 at 6:32 am #140053No, the Avia advanced editor does not support php code, etc. snippets. You can use plugins like: http://wordpress.org/plugins/php-snippets/ or http://wordpress.org/plugins/insert-html-snippet/ 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.
September 9, 2013 at 11:52 am #140054Thank 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.
September 10, 2013 at 3:47 am #140055Hey,
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.
Regards,
Ismael
September 14, 2013 at 5:41 am #140056Thanks 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?
-Dan
September 16, 2013 at 3:26 am #161528Hi 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.
Regards,
Devin
September 27, 2013 at 11:11 pm #167324Thanks Devin, recreating the text element seemed to do it.
-
AuthorPosts
- The topic ‘Adding just "code" with Avia advanced editor’ is closed to new replies.