Convert [xcode]foo[/xcode] to <pre>foo</pre>

I'm converting vBulletin content to WP with the Crayon syntax highlighter. What is the best way to convert the content's [xcode]foo[/xcode] to pre class="lang:default decode:true "foo/pre for Crayon?

I see info about the Crayon legacy tags conversion but the screenshots are missing and I don't know how to enable "legacy tags" for Crayon.

Topic plugin-syntaxhighlighter Wordpress

Category Web


What you need is Shortcode API.

Just add your own shortcode (put this into your themes functions.php or as a plugin):

function my_shortcode_xcode_handler( $atts, $content = null ) {
    return '<pre class="lang:default decode:true ">'. do_shortcode($content) .'</pre>';
}
add_shortcode( 'xcode', 'my_shortcode_xcode_handler' );

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.