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
      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

      WP Adminify

      Take control of your WordPress dashboard. Customize the admin experience.
      Admin Bar Editor

      Admin Bar Editor

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

      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

      Master Blocks

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

      WP Spotlight

      Instantly search and access admin features, posts, and settings from anywhere.
  • Themes
  • Help
    • Get Support
    • Documentation
    • Facebook Community
    • Changelogs
  • Blog
Pricing
🇺🇸EN
  • 🇺🇸EN
  • 🇸🇦AR
  • 🇧🇩BN
  • 🇩🇰DA
  • 🇩🇪DE
  • 🇪🇸ES
  • 🇫🇷FR
  • 🇮🇳HI
  • 🇰🇷KO
  • 🇵🇹PT
  • 🇷🇺RU
  • 🇨🇳ZH

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

  • Popup Trigger
  • 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

  • Mega Menu
  • 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

  • Conditions
  • Twig Syntax
  • Settings Panel Introduction
  • Divider
  • Text Shadow
  • Select2
  • Border
  • Heading
  • Tabs
  • Repeater
  • Visual Choice
  • Background
  • Dimensions
  • Box Shadow
  • Slider
  • Icons
  • Gallery
  • Media
  • Popover Toggle
  • URL Field
  • Date Time
  • Typography
  • Font
  • Color Field
  • Choose
  • Select
  • Switcher
  • Hidden
  • Code
  • WYSIWYG
  • Textarea Field
  • Number
  • 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
  • Media

Media

Roy Jemee
Updated on August 6, 2026

7 min read

The Media field connects a custom widget to the WordPress media library. Drop the field in, and anyone editing the widget in Elementor gets the familiar image chooser: click, pick or upload, done. Inside the Master Addons Widget Builder, it is the field behind hero images, avatars, logos, and every other single-image slot a widget needs.

Like every Widget Builder field, Media supports Conditions for panel visibility. Its token renders through the Twig-syntax template engine, which prints the file URL automatically, so <img src="{{ photo }}"> just works. Both guides cover the details.

Unlike a text field, the Media field’s value is not one string. It is an array carrying the file’s url, id, alt, and more, and your template reaches each piece with dot notation. There is one friendly shortcut: printing the field directly gives you the URL. And one habit worth building from day one, guarding the markup with an {% if %} so an empty field leaves no broken image behind.

What the Media field does #

  • Opens the WordPress media library from the Elementor panel, upload or pick from existing files.
  • Stores the selection as an array with url, id, and alt among its keys.
  • Prints the URL on a direct token: {{ hero_image }} outputs the file URL as a shortcut.
  • Exposes each property by dot notation: {{ hero_image.url }}, {{ hero_image.id }}, {{ hero_image.alt }}.
  • Can filter the library by media type, image, video, or audio, and supports dynamic values.

If you are new to building widgets, start with the Widget Builder overview first.

Before you start #

  • WordPress with Elementor installed and active.
  • Master Addons for Elementor installed and active. New to the plugin? See the installation guide.
  • A custom widget open in the Widget Builder editor. Our example is a restaurant hero widget with a single Media field named hero_image that fills the banner.

How to add a Media field #

In the Widget Builder editor, find the Media field in the panel on the left, grouped with the other media fields.

Drag it into a section under the Content tab; an image is content, even when it ends up as a CSS background. Once it lands, the field’s options open on the left.

Media field options explained #

  • Label: the text shown above the chooser in Elementor, for example “Hero Image”.
  • Name: the unique identifier for the field, letters, numbers, and underscores only, for example hero_image.
  • Default: a starting file as a URL and ID pair, so the widget drops onto the page already looking finished.
  • Media Type: filters what the library offers, image, video, or audio, keeping editors from wiring an mp3 into an img tag.
  • Dynamic: lets the value come from a dynamic source rather than a fixed pick.
  • Description, Show Label, Separator: the standard display settings, plus Conditions for showing the field only when another control has a certain value.

Connect the Media field to your template #

The value is an array, and the template rules follow from that. The direct token is a shortcut for the most common need:

<img src="{{ hero_image }}">

Printing an array value directly outputs its url key, so this renders the file URL. The explicit form does the same and reads more clearly next to its siblings:

<img src="{{ hero_image.url }}" alt="{{ hero_image.alt }}">
<!-- {{ hero_image.id }} holds the attachment ID -->

Now the habit that separates tidy widgets from broken-icon widgets: the empty guard. A Media field with nothing picked renders empty attributes, and <img src=""> shows as a broken image. Wrap the markup:

{% if hero_image.url %}
<img src="{{ hero_image.url }}" alt="{{ hero_image.alt }}">
{% endif %}

The field works in the CSS tab too. A background slot is one line:

.hero-banner {
  background-image: url('{{ hero_image }}');
}

Watch out for alt text passing through untouched. {{ hero_image.alt }} prints whatever the media library holds, and libraries are full of images with empty alt fields. The guard keeps the attribute present but it cannot invent the text. Widgets built for clients deserve a note telling editors to fill alt text in the library.

Use the Media control in Elementor #

Add your custom widget to a page in Elementor, reloading the editor if the page was already open. The Media field renders as Elementor’s standard image chooser box under your label.

Click the box and the WordPress media library opens, filtered to the media type you set. Pick or upload a file, confirm, and the preview updates the moment the selection lands.

Swapping the image later is the same click. Removing it empties the value, which is exactly the case your {% if %} guard covers.

Common use cases #

  • Hero and banner images, as an img tag or a CSS background.
  • Avatars and headshots in testimonial and team widgets.
  • Logos in header, footer, and client-strip widgets.
  • Card thumbnails where each widget instance features one image.
  • Decorative section backgrounds set through background-image in the CSS tab.

Tips for working with the Media field #

  • Always guard with {% if hero_image.url %}. An unset field otherwise renders an empty src and a broken-image icon.
  • Print the alt. alt="{{ hero_image.alt }}" costs nothing and carries the library’s alt text into your markup.
  • Use the direct token for CSS backgrounds. url('{{ hero_image }}') keeps the CSS tab readable.
  • Set a default image. A widget that drops onto the page with a real photo sells itself; a gray placeholder does not.
  • Filter with Media Type. If the slot is an image, say so, and the library will not offer videos.
  • Remember the shortcut is url-only. Any property other than the URL needs dot notation; there is no shortcut for id or alt.

Frequently Asked Questions #

What is the Media field in the Master Addons Widget Builder?

The Media field adds a WordPress media library picker to a custom Elementor widget. The selected file is stored as an array with url, id, and alt keys, which your template prints through {{ field_name }} for the URL or {{ field_name.prop }} for a specific property.

What does {{ hero_image }} print by itself?

The file URL. Printing an array value directly outputs its url key when one exists, so <img src="{{ hero_image }}"> works as a shortcut. For anything else, use dot notation: {{ hero_image.id }}, {{ hero_image.alt }}.

How do I stop a broken image when nothing is selected?

Wrap the markup in a guard: {% if hero_image.url %}...{% endif %}. An unset Media field renders empty attributes otherwise, and an empty src attribute displays as a broken image in most browsers.

Can I use the Media field as a CSS background?

Yes. In the CSS tab, write background-image: url('{{ hero_image }}'); on the element that should carry the photo. The token resolves to the file URL there just as it does in HTML.

Can the field accept videos or audio?

The Media Type option filters the library to image, video, or audio. Set it to match what your template expects, so an img-tag slot only ever receives image files.

What is the difference between Media and Gallery?

Media holds one file; Gallery holds an ordered set of images that your template prints with a {% for %} loop. One hero photo is a Media field; a portfolio grid is a Gallery.

Wrapping up #

The Widget Builder Media field is the single-image workhorse. A library picker in the panel, a URL shortcut in the template, dot notation for id and alt, and an {% if %} guard standing between your widget and a broken-image icon. When one image becomes many, move up to the Gallery field and its loop. Explore the rest of the Master Addons widgets and extensions, and see the pricing page for what each plan includes.

What are your Feelings

Share This Article :

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

How can we help?

Updated on August 6, 2026
GalleryPopover Toggle
Table of Contents
  • What the Media field does
  • Before you start
  • How to add a Media field
  • Media field options explained
  • Connect the Media field to your template
  • Use the Media control in Elementor
  • Common use cases
  • Tips for working with the Media field
  • Frequently Asked Questions
    • What is the Media field in the Master Addons Widget Builder?
    • What does {{ hero_image }} print by itself?
    • How do I stop a broken image when nothing is selected?
    • Can I use the Media field as a CSS background?
    • Can the field accept videos or audio?
    • What is the difference between Media and Gallery?
  • Wrapping up

Join 30,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

80+ 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
Support
  • Support Forum
  • Contact US
  • Join Community
  • Blog
  • Video Reviews
Resources
  • My Account
  • Changlogs
  • Documentation
  • Video Tutorials
  • Toolz.dev
Navigate
  • Apply for Affiliate
  • Terms of Use
  • Refund Policy
  • Privacy Policy
  • About Us