Developer Documentation

Video Modal Plugin Guide

Document Version: 2.1.0 | Last Revised:

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:

Attribute Default Description
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 LiteSpeed/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.