Master Addons
  • Widgets
    • Changelogs
      Source Code NEW PRO
      Caldera Forms
      Logo Slider
      Table of Contents
      Gravity Forms
      Transforms PRO
      Restrict Content PRO
      Pricing Table
      Ninja Form
      Mailchimp
      Tooltip
      Popup Trigger NEW PRO
      Which Element NEW
      Creative Button
      Creative Links NEW
      Domain Search HOT PRO
      Dual Heading HOT
      Flipbox
      Animated Gradient BG HOT PRO
      Image Hotspot PRO
      Infobox
      News Ticker PRO
      Particles
      Progress Bar
      Off-Canvas Content NEW PRO
      Reading Progress Bar HOT
      Custom JS
      Blockquote
      Counter Up
      Image Hover Effects
      Reveal NEW PRO
      Rellax PRO
      Positioning
      Image Comparison
      Tabs
      Toggle Content HOT PRO
      Post/Page Duplicator FREE
      Icons Extended
      Floating Effects PRO
      Mega Menu HOT
      Custom CSS HOT
      Gradient Headline
      Advanced Image
      Nav Menu
      Tooltips
      Comparison Table PRO
      Glassmorphism
      Featured Product PRO
      Image Carouse
      Gallery Slider NEW PRO
      Dynamic Tags NEW
      Countdown Timer
      Current Time
      Patterns
      Wrapper Link
      Timeline
      Team Member
      Contact Form 7
      Advanced Accordion
      Animated Headlines
      Blog
      Business Hours
      Call To Action
      Progress Bars
      Background Slider
      Team Slider
      Dynamic Table
      Grid Line PRO
      WP Forms
      Search
      We Form
      Entrance Animation NEW PRO
      Display Conditions PRO
      Filterable Image Gallery
      WP Forms
      Custom Breakpoints NEW
  • Features
    • Theme Builder

      Design site-wide templates for a consistent look across every page of your website.

      Popup Builder

      Create engaging popups, modals, and announcement bars - to capture leads.

      Widget Builder

      Expand Elementor with advanced custom widgets to build more dynamic layouts.

      Mega Menu Builder

      Create multi-column menus with icons and images for superior navigation.

      Custom Css

      Apply your own CSS for pixel-perfect styling beyond default design options.

      Dynamic Tags

      Insert dynamic content like post titles and custom fields directly into designs.

      Display Conditions

      Control element visibility based on user role, device, time, and other rules.

      Icons Library

      Choose from thousands of built-in icons to enhance visuals and consistency.

      Animation

      Add scroll, hover, entrance, and much more animations to bring designs to life.
  • Template Kits
    • Template Kits

      Professionally designed full-page template Kit. Import and customize in seconds.

      Ready Sections

      Pre-built content sections and rows. Drag, drop, and customize instantly.

      Ready Popups

      Different types of High-converting popup designs. Import and launch quickly.

      Ready Pages

      Complete page layouts for any purpose. Start editing immediately.

      Ready Header

      Multiple modern header designs. Import and adapt to your brand.

      Ready Footer

      Fully designed footers for different websites. Add functionality and style in clicks.
  • Brands
    • WP Adminify

      Take control of your WordPress dashboard. Customize the admin experience.

      Admin Bar Editor

      Customize the WordPress admin bar for a cleaner, more personalized workspace.

      Loginfy

      Customize your WordPress login page with branding, styles, and security enhancements.

      Rolemaster Suite

      Manage user roles and permissions with precision for better security and workflow.

      Master Blocks

      Expand the Gutenberg editor with advanced custom blocks for more creative layouts.

      WP Spotlight

      Instantly search and access admin features, posts, and settings from anywhere.
  • Themes
  • Help
    • Get Support
    • Documentation
    • Facebook Community
    • Changelogs
  • Blog
  • Widgets
    • Changelogs
      Source Code NEW PRO
      Caldera Forms
      Logo Slider
      Table of Contents
      Gravity Forms
      Transforms PRO
      Restrict Content PRO
      Pricing Table
      Ninja Form
      Mailchimp
      Tooltip
      Popup Trigger NEW PRO
      Which Element NEW
      Creative Button
      Creative Links NEW
      Domain Search HOT PRO
      Dual Heading HOT
      Flipbox
      Animated Gradient BG HOT PRO
      Image Hotspot PRO
      Infobox
      News Ticker PRO
      Particles
      Progress Bar
      Off-Canvas Content NEW PRO
      Reading Progress Bar HOT
      Custom JS
      Blockquote
      Counter Up
      Image Hover Effects
      Reveal NEW PRO
      Rellax PRO
      Positioning
      Image Comparison
      Tabs
      Toggle Content HOT PRO
      Post/Page Duplicator FREE
      Icons Extended
      Floating Effects PRO
      Mega Menu HOT
      Custom CSS HOT
      Gradient Headline
      Advanced Image
      Nav Menu
      Tooltips
      Comparison Table PRO
      Glassmorphism
      Featured Product PRO
      Image Carouse
      Gallery Slider NEW PRO
      Dynamic Tags NEW
      Countdown Timer
      Current Time
      Patterns
      Wrapper Link
      Timeline
      Team Member
      Contact Form 7
      Advanced Accordion
      Animated Headlines
      Blog
      Business Hours
      Call To Action
      Progress Bars
      Background Slider
      Team Slider
      Dynamic Table
      Grid Line PRO
      WP Forms
      Search
      We Form
      Entrance Animation NEW PRO
      Display Conditions PRO
      Filterable Image Gallery
      WP Forms
      Custom Breakpoints NEW
  • Features
    • Theme Builder

      Design site-wide templates for a consistent look across every page of your website.

      Popup Builder

      Create engaging popups, modals, and announcement bars - to capture leads.

      Widget Builder

      Expand Elementor with advanced custom widgets to build more dynamic layouts.

      Mega Menu Builder

      Create multi-column menus with icons and images for superior navigation.

      Custom Css

      Apply your own CSS for pixel-perfect styling beyond default design options.

      Dynamic Tags

      Insert dynamic content like post titles and custom fields directly into designs.

      Display Conditions

      Control element visibility based on user role, device, time, and other rules.

      Icons Library

      Choose from thousands of built-in icons to enhance visuals and consistency.

      Animation

      Add scroll, hover, entrance, and much more animations to bring designs to life.
  • Template Kits
    • Template Kits

      Professionally designed full-page template Kit. Import and customize in seconds.

      Ready Sections

      Pre-built content sections and rows. Drag, drop, and customize instantly.

      Ready Popups

      Different types of High-converting popup designs. Import and launch quickly.

      Ready Pages

      Complete page layouts for any purpose. Start editing immediately.

      Ready Header

      Multiple modern header designs. Import and adapt to your brand.

      Ready Footer

      Fully designed footers for different websites. Add functionality and style in clicks.
  • Brands
    • WP Adminify

      Take control of your WordPress dashboard. Customize the admin experience.

      Admin Bar Editor

      Customize the WordPress admin bar for a cleaner, more personalized workspace.

      Loginfy

      Customize your WordPress login page with branding, styles, and security enhancements.

      Rolemaster Suite

      Manage user roles and permissions with precision for better security and workflow.

      Master Blocks

      Expand the Gutenberg editor with advanced custom blocks for more creative layouts.

      WP Spotlight

      Instantly search and access admin features, posts, and settings from anywhere.
  • Themes
  • Help
    • Get Support
    • Documentation
    • Facebook Community
    • Changelogs
  • Blog
Purchase Now

Getting Started

  • Can’t see the Master Addon Element inside Elementor Page editor?
  • How To Apply For an Affiliate Account?
  • Active Pro version
  • Installing Plugin

Addons

  • Off-Canvas Content
  • Logo Slider
  • Progress Bars
  • Image Carousel
  • Featured Product
  • Comparison Table
  • Source Code
  • Advanced Image
  • Gradient Headline
  • Gallery Slider
  • Toggle Content
  • Infobox
  • Timeline
  • Dynamic Table
  • Mailchimp
  • Blockquote
  • Changelogs
  • Countdown Timer
  • Current Time
  • Search
  • Filterable Image Gallery
  • Team Slider
  • Counter Up
  • Restrict Content
  • Table of Contents
  • Image Hotspot
  • Image Comparison
  • News Ticker
  • Image Hover Effects
  • Tabs
  • Pricing Table
  • Navigation Menu
  • Domain Search
  • Flipbox
  • Tooltip
  • Creative Links
  • Business Hours
  • Contact Form 7
  • Creative Button
  • Animated Headlines
  • Advanced Accordion
  • Call to Action
  • Progress Bar
  • Blog
  • Team Member
  • Dual Heading

Extensions

  • Which Element
  • Post Duplicator
  • Grid Line
  • Glassmorphism
  • Tooltip
  • Wrapper Link
  • Floating Effects
  • Dynamic Tags
  • Display Conditions
  • Entrance Animation
  • Custom Breakpoints
  • Animated Gradient Background
  • Reveal
  • Particles
  • Background Slider
  • Transforms
  • Rellax
  • Positioning
  • Custom CSS

Widget Builder

  • Widget Builder Settings Panel Introduction
  • Divider
  • Text Shadow
  • Select2
  • Border
  • Heading
  • Tabs
  • Repeater
  • Visual Choice
  • Background
  • Dimensions
  • Box Shadow
  • Slider
  • Icons
  • Gallery
  • Media
  • Popover Toggle
  • Widget Builder URL Field
  • Date Time
  • Typography
  • Font
  • Widget Builder Color Field
  • Choose
  • Select
  • Switcher
  • Hidden
  • Code
  • WYSIWYG
  • Widget Builder Textarea Field
  • Number
  • Widget Builder Text Field

Theme Builder

  • Comment Form
  • 404
  • Search
  • Archive
  • Single
  • Footer
  • Header

Popup Builder

  • How to Open a Popup After Inactivity in Elementor
  • How to Show an Exit Intent Popup in Elementor
  • How to Open a Popup on Scroll to a Specific Element in Elementor
  • How to Open a Popup on Scroll in Elementor
  • How to Open a Popup on Click in Elementor
  • How to open a popup on page load?
  • Popup Settings & Options

Template Kit

  • How to Import Template Kits in Master Addons
  • How to Disable Elementor Default Fonts and Colors
  • Import Elementor Template Kits
View Categories
  • Home
  • Docs
  • Widget Builder
  • Code

Code

Roy
Updated on June 30, 2026

7 min read

The Code option is a specialized control that adds a syntax-highlighted code editor field to your custom widget’s settings. It allows users to input and edit raw code snippets in various programming and markup languages directly from the Elementor editor.

Why would someone use it in a custom widget? #

Use this control when you need to provide users with a way to insert custom code snippets that are part of the widget’s functionality or output. This is ideal for adding custom HTML structures, inline CSS/JS, shortcodes from other plugins, SVG graphics, or template snippets, all with the benefit of proper syntax highlighting for accuracy.

Where This Option Appears #

  • In Widget Builder: You add this control in the Content tab. It appears as a field configurable for a specific programming language.
  • In the Elementor Editor: Once saved, it appears as a dedicated code editor panel within your widget’s settings. It features line numbers and color-coded syntax highlighting based on the selected language, making code easier to write and review.

Available Settings #

Here are the configurable settings for the Code control based on the provided screenshots:

Basic Settings #

  • Label: The name of the control shown above the editor (e.g., “Custom HTML”, “Inline CSS”, “Header Script”).
  • Name: The unique machine-readable ID (like custom_html) used to create the dynamic shortcode.
  • Description: Optional text that appears below the editor to provide context (e.g., “Enter valid HTML for the banner.”).
  • Language: This is the core feature. A dropdown menu to set the syntax highlighting language for the editor. Major supported languages include:
    • Markup/Data: HTML, Markdown, SVG, JSON, Text
    • Stylesheets: CSS, SASS, SCSS, LESS
    • Programming/Scripting: JavaScript, TypeScript, PHP, Python, Twig
    • Database: SQL, MySQL

Advanced Settings #

  • Show Label: Toggles the control’s label on or off.
  • Label Block (Display Label): Makes the label take the full width of the panel.
  • Responsive Control: Allows setting different code values for desktop, tablet, and mobile views.
  • Dynamic Support: When enabled, the content of this code field can be populated dynamically from a WordPress source.
  • Frontend Available: When enabled, the code content is passed to your widget’s frontend JavaScript as a string variable.
  • Separator: Adds a visual line to group this control.
  • Conditions: Show or hide this code editor based on other control values.
  • Control Classes & Selector: Allows advanced styling of the control’s wrapper in the editor panel.

Generated Shortcode #

When you add a Code control with the Name custom_css, Widget Builder generates the dynamic shortcode: {{custom_css}}.

  • What it represents: This shortcode is a placeholder for the exact raw code text entered into the field, without automatic execution or rendering.
  • Where to use it: You can place this shortcode in your HTML Panel to output the code as a text string. Crucially, it is most powerful when used in your widget’s main Code panels (JS/HTML/CSS) to dynamically inject user-provided code into your template logic.

How to Use It: A Practical Example #

Let’s create an “Embed Snippet” widget that lets users safely add custom HTML or scripts.

  1. In Widget Builder’s Content tab, add a Code control.
  2. Set the Label to Custom HTML Snippet. The Name will auto-fill as custom_html_snippet.
  3. Select HTML as the Language for proper highlighting.
  4. In your widget’s main HTML Panel, you can place the shortcode where the code should be injected: {{{custom_html_snippet}}}. (Note: Triple braces {{{ }}} might be required to output raw, unescaped HTML).
  5. Alternatively, in your main JS Panel, you could use the value to create a dynamic element: document.getElementById('target').innerHTML = '{{custom_html_snippet}}';.

Now, in Elementor, a user can drag in your widget and paste a complex HTML snippet (like an embed code for a video, map, or calculator) into the dedicated, highlighted editor field.

Common Use Cases #

  • Custom HTML/Embed Blocks: Allow users to insert third-party embed codes (YouTube, Maps, Calendars) or custom HTML structures.
  • Inline Style/Script Injection: Provide a field for power users to add page-specific CSS rules or JavaScript snippets.
  • Shortcode Support: Let users input shortcodes from other plugins (e.g., 

    Error: Contact form not found.

    ) that your widget will then execute.
  • Dynamic SVG Graphics: Use with the SVG language setting to let users paste raw SVG code for custom icons or illustrations.
  • Template Tags/Snippets: For advanced widgets, provide a field to insert logic snippets (e.g., PHP or Twig code for developers).

Helpful Tips #

  • Choose Language Wisely: Setting the correct Language dramatically improves usability by providing the right highlighting and hinting, preventing syntax errors.
  • Security Consideration: Be cautious. A Code control that outputs raw HTML/JS can be a security risk if misused. It’s best suited for trusted admin users or specific, controlled use cases.
  • Use for Configuration: This control is excellent for making a widget highly configurable. For example, a “Chart” widget could have a Code control set to JSON where users paste their custom data configuration.
  • Combine with Conditions: Use the Conditions setting to show a “Custom CSS” code editor only if a user switches a “Advanced Mode” toggle to “On,” keeping the interface clean for beginners.

Frequently Asked Questions #

What is the Code control in Widget Builder?

The Code control adds a syntax-highlighted code editor field to your custom widget’s settings, letting users enter and edit raw code snippets in various languages directly from the Elementor editor. You add it in the Content tab, and once saved it appears as a dedicated editor panel with line numbers and color-coded highlighting. It is ideal for custom HTML, inline CSS or JS, SVG, and template snippets.

Which languages does the Code control support?

The Language dropdown sets the syntax highlighting and supports a wide range of options. These include markup and data formats like HTML, Markdown, SVG, JSON, and Text; stylesheet languages CSS, SASS, SCSS, and LESS; programming and scripting languages JavaScript, TypeScript, PHP, Python, and Twig; and database languages SQL and MySQL. Choosing the correct language improves usability and helps prevent syntax errors.

Does the Code control automatically run the code that is entered?

No. The shortcode it generates, such as {{custom_css}} for a control named custom_css, is a placeholder for the exact raw code text without automatic execution or rendering. You decide where it goes, typically injecting it into your widget’s main HTML, CSS, or JS panels. Note that outputting raw HTML may require triple braces like {{{custom_html_snippet}}} to keep it unescaped.

Can I show the Code editor only under certain conditions?

Yes. Use the Conditions setting in the Advanced options to show or hide the code editor based on other control values. For example, you can display a “Custom CSS” code editor only when a user switches an “Advanced Mode” toggle to On, keeping the interface clean for beginners. You can also enable Responsive Control to set different code values for desktop, tablet, and mobile.

Is the Code control safe to expose to end users?

Use it with care. Because a Code control can output raw HTML or JavaScript, it can be a security risk if misused, so it is best suited for trusted admin users or specific, controlled use cases. When configured responsibly it is excellent for highly configurable widgets, such as a chart widget using a JSON-language Code field where users paste their data configuration.

What are your Feelings

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Updated on June 30, 2026
HiddenWYSIWYG
Table of Contents
  • Why would someone use it in a custom widget?
  • Where This Option Appears
  • Available Settings
    • Basic Settings
    • Advanced Settings
  • Generated Shortcode
  • How to Use It: A Practical Example
  • Common Use Cases
  • Helpful Tips
  • Frequently Asked Questions
    • What is the Code control in Widget Builder?
    • Which languages does the Code control support?
    • Does the Code control automatically run the code that is entered?
    • Can I show the Code editor only under certain conditions?
    • Is the Code control safe to expose to end users?

Join 40,000+ Web Creators Who Trust Master Addons

Get all the premium widgets and templates you desire, built with clean code that keeps your site fast. Ditch the bloat, not the features.

Try Live Demo
Join The Community
Master Addons for Elementor
Master Addons Logo

110+ Premium Widgets & Lifetime Updates – Build Beyond Limits. An Exclusive Creation by Pixar Labs

Facebook-f Twitter Youtube Wordpress
Features
  • Template kits
  • Template Library
  • Widget Builder
  • Theme Builder
  • Mega Menu Builder
  • Template kits
  • Template Library
  • Widget Builder
  • Theme Builder
  • Mega Menu Builder
Support
  • Support Forum
  • Contact US
  • Join Community
  • Blog
  • Support Forum
  • Contact US
  • Join Community
  • Blog
Resources
  • Apply For Affiliate
  • Documentation
  • Video Tutorials
  • My Account
  • Change Log
  • Apply For Affiliate
  • Documentation
  • Video Tutorials
  • My Account
  • Change Log
Navigate
  • Terms of Use
  • Refund Policy
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Privacy Policy