Skip to main content

Search here to get answers to you questions.

How to Use Custom Elements and Buttons to Switch Dark Mode?

Want to let users switch between light and dark modes on your WordPress site? With the Dracula Dark Mode plugin, you can easily add custom elements like buttons or switches to toggle Dark Mode.

 

This guide will show you how to set up and customize these triggers to fit your site’s style, giving users full control over their viewing experience.

How to Implement Custom Trigger?

Implementing a custom trigger to toggle dark mode is easier. Follow the below steps to understand & implement it properly.

 

  • Navigate to Dracula Dark Mode in your WordPress dashboard.
  • Go to Settings.
  • Under Toggle Switch > Custom Trigger.
  • Click on Add New Trigger.
  • Enter your desired CSS Selector for the custom element (button, switch, etc.). If you want to add more triggers just click the Add New Trigger button.
  • Click Save Changes to apply the new trigger.

 

This will add a custom toggle to your site, allowing users to switch between light and dark modes based on your chosen element.