WordPress | Dark Theme Mode | Convert Any Theme To Dark

Follow the following steps:

  • DOWNLOAD AND ADD FOLLOWING FILES:
    • TO FOLDER: “…/wp-content\themes\<theme-name>\assets\js\”
    • FILES: “darkreader.js and “darkreader-api.js”
    • DOWNLOAD FROM:
  • ADD FOLLOWING CODE:
    • IN FILE: “…/wp-content/themes/<theme-name>/functions.php”
    • IN FUNCTION: function onepress_scripts() {…}
    • ADD THESE LINES OF CODE AT THE END:
      • wp_enqueue_script( ‘darkreader’, get_template_directory_uri() . ‘/assets/js/darkreader.js’, array(),”, false );
      • wp_enqueue_script( ‘darkreader-api’, get_template_directory_uri() . ‘/assets/js/darkreader-api.js’, array(),”, false );
  • Refresh page to get dark mode; Control+F5 if browser is catching CSS.

Leave a Reply

Your email address will not be published. Required fields are marked *