Enable Dark Mode for Init Embed Posts

Init Embed Posts is a plugin that lets you embed WordPress posts on other websites using modern, responsive card-style blocks—without relying on iframes. This article shows you how to enable dark mode for the embed code modal in the plugin settings page, making it consistent with your site’s dark theme or admin interface.

Enable Dark Mode for Init Embed Posts

1. Configure Before Plugin Initialization

Add the following snippet inside your <head> tag or just before loading the plugin’s main JavaScript file:

window.InitPluginSuiteEmbedPostsConfig = {
    theme: 'dark'
};

Accepted theme values:

  • 'light' – Always use light mode
  • 'dark' – Always use dark mode
  • 'auto' – Automatically match the user’s system preference

Example: Enable dark mode if the site uses the uk-light class

document.addEventListener('DOMContentLoaded', function () {
    if (document.body.classList.contains('uk-light')) {
        window.InitPluginSuiteEmbedPostsConfig = {
            theme: 'dark'
        };
    }
});

2. Where Dark Mode Applies

  • The embed code modal (shown when clicking the “Embed” button)
  • Admin icons or UI elements included in your editor or settings page

Notes

  • The plugin automatically adds the iep-dark class to the modal when dark mode is enabled or detected.
  • You can further customize the modal’s appearance using the .iep-dark class if needed.

Comments


  • No comments yet.

Init Toolbox

Press Ctrl + \ on desktop, or swipe left anywhere on mobile.

Login