Video Modal Plugin — Developer Guide

A lightweight, dev-centric solution for WordPress. Prioritizes page speed by deferring modal rendering to the footer and utilizing a clean, shortcode-driven architecture.

Version 2.1.0 Developer Docs View on WordPress.org

Performance-First Video Integration

The Smartupworld Video Modal Plugin is a lightweight, dev-centric solution for WordPress. Unlike standard embed tools, this plugin prioritizes page speed by deferring modal rendering to the footer and utilizing a clean, shortcode-driven architecture. Ideal for technical SEO and high-performance business sites.

  • Deferred Modal Rendering
  • Customizable Shortcodes
  • Unique ID Conflict Prevention
  • Built-in Cache Toggling

Shortcode Implementation

Register and trigger video modals using the [video_modal] shortcode. Use the following attributes to customize behavior:

AttributeDefaultDescription
url (Required) Path to MP4 or external video source.
button Watch Video The text label for the trigger button.
class (None) Custom CSS classes for button styling.

Standard Usage Example

[video_modal url="https://mysite.com/video.mp4" button="Watch Story" class="swb-btn-primary"]

Development Mode & Cache Toggling

To prevent browser caching during development, the plugin includes a SMARTUPWORLD_DEV_MODE toggle. This appends dynamic timestamps to all enqueued assets.

Development (Value: 1)

Assets load with random version numbers. Ideal for rapid CSS/JS debugging.

Production (Value: 0)

Assets load with fixed versioning for optimal CDN caching.

Advanced Customization

  • Override assets/style.css for UI themes.
  • Extend assets/script.js for autoplay logic.
  • Add filters for 3rd-party video providers.
  • Attach analytics events to modal triggers.

Troubleshooting

Modal not opening? Confirm wp_footer() is present in your theme template.

Video not loading? Verify the url points to a valid file or supported external source.

Spacing issues? We use shortcode_unautop(), but check for theme-level Paragraph filter conflicts.

Frequently Asked Questions

Does the modal affect page speed?

No. The modal markup is rendered in the footer and only triggered on click, so it has zero impact on initial page load or LCP.

Can I use external video URLs?

Yes. The url attribute accepts any valid MP4 path or supported external video source.

What if I have multiple modals on one page?

Each shortcode generates a unique ID automatically to prevent conflicts.

Changelog

2.1.0
  • Developer guide documentation updated.
  • Added SMARTUPWORLD_DEV_MODE cache toggle.
  • Improved unique ID generation for multiple modals.
1.0.0
  • Initial release.
  • Deferred modal rendering to footer.
  • Shortcode-driven architecture with [video_modal].