Skip to content

Native Divi 5 ModuleFree

Divi Code Snippet

Syntax-highlighted code blocks with line numbers and copy.

See the Divi Code Snippet in action

A live snippet. Try the Copy button. The highlighter runs only on pages that use the module.

functions.phpphp
add_action( 'wp_enqueue_scripts', function () {
    if ( ! is_singular( 'post' ) ) {
        return;
    }

    wp_enqueue_style(
        'brand-tweaks',
        get_stylesheet_directory_uri() . '/css/brand.css',
        array(),
        '1.2.0'
    );
} );

Why use the Divi Code Snippet module?

Paste code into a text module and it comes out mangled. The Divi Code Snippet module publishes it the way documentation sites do.

Highlighting that’s realThirteen languages and four themes, powered by Prism.
Copy that just worksOne click with Copied feedback. Labels are editable.
Reads like an editorFilename header, language label, and line numbers.
No site-wide weightThe highlighter loads only where the module is used.

Everything the Divi Code Snippet module does

Every option below ships in the free plugin.

13 languages: PHP, JS, TS, JSX, CSS, HTML, Python, Bash, JSON, SQL, YAML, MarkdownDark, light, midnight & paper themesFilename header + language labelLine numbers with start offsetOne-click Copy / CopiedOptional line wrappingMax height with scrollingCorner radius and typography controlLoads only where used

Get Code Snippet and 78 more.

One license, every module and extension, native on Divi 5.