Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #737820

    In advanced editor we have text block and code block. Neither of these work for XML snippets. If you set the contents of either to contain a code block with XML content the content gets lost.

    For example: try using a CodeBlock to embed :

    <General> <Settings> </Settings> </General>

    Basically, because the XML structures look like XHTML/HTML they get striped away and you get nothing out when the post/page is displayed.

    What I need is a RawBlock where the content is not interpreted by enfold or the browser but is just dumped raw into the post/page rendering stream.

    It’s a modified CodeBlock where the contents is treated specially (no interpretation). The editor needs to be just a text editor and the string is stored and echoed.

    #739681

    Hey peernet!

    Thank you for using Enfold.

    In the code block element, you can enable the “Escape HTML Code” option to display the actual xml codes. Unfortunately, the display or appearance is quite bland. Or you can create another shortcode.

    function xml_shortcode( $atts, $content ) {
    	$filter = array('<br>','<br />');
    	$content = str_replace($filter, '', $content);
        return "<code><pre>" . esc_html($content) . "</pre></code>";
    }
    
    add_shortcode( 'avaxml', 'xml_shortcode' );

    In a code block, you can use this for example:

    [avaxml]
    <?xml version="1.0" encoding="UTF-8"?>
    <note>
      <to>Tove</to>
      <from>Jani</from>
      <heading>Reminder</heading>
      <body>Don't forget me this weekend!</body>
    </note>
    [/avaxml]

    Regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.