--- title: "Divi Code Snippet" url: "https://divitorque.com/features/code-snippet.md" canonical: "https://divitorque.com/features/code-snippet/" published: "2026-08-12" modified: "2026-08-12" author: "Fahim Reza" description: "Publish syntax-highlighted code with line numbers, a filename header, and a copy button. A native Divi 5 module by Divi Torque, free." --- # Divi Code Snippet ## 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.php php Copy ``` 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 real Thirteen languages and four themes, powered by Prism. Copy that just works One click with Copied feedback. Labels are editable. Reads like an editor Filename header, language label, and line numbers. No site-wide weight The 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, Markdown Dark, light, midnight & paper themes Filename header + language label Line numbers with start offset One-click Copy / Copied Optional line wrapping Max height with scrolling Corner radius and typography control Loads only where used