• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Add dark mode toggle to responsive menu

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Add dark mode toggle to responsive menu

This topic is: not resolved

Tagged: menu responsive darkmode

  • This topic has 1 reply, 1 voice, and was last updated 2 years, 2 months ago by eddie.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • January 25, 2021 at 10:12 am #502803
    eddie
    Participant

    I've been successfully able to add my dark mode toggle to the full width menu as you can see. Works great.
    toggle

    However, because I want this VERY handy, I would also like to put it directly next to the "MENU" item in the responsive menu. I haven't been able to do this successfully. I tried the following code, which places the toggle but it doesn't work since it is nested inside the menu button.

    Any ideas?

    
    function monochrome_responsive_menu_settings() {
    
            $settings = [
                    'mainMenu'         => __( 'MENU' . do_shortcode('[dark-mode-toggle]'), 'monochrome-pro' ),
                    'menuIconClass'    => 'ionicons-before ion-ios-menu',
                    'subMenu'          => __( 'Submenu', 'monochrome-pro' ),
                    'subMenuIconClass' => 'ionicons-before ion-ios-arrow-down',
                    'menuClasses'      => [
                            'combine' => [],
                            'others'  => [
                                    '.nav-primary',
                            ],
                    ],
            ];
    
            return $settings;
    
    }
    
    January 25, 2021 at 11:37 am #502804
    eddie
    Participant

    The secret to getting your answers is asking... because I always seem to figure it out after asking.

    I simply added the following to my functions.php

    
    add_action( 'genesis_header', 'dark_mode_toggle' );
    function dark_mode_toggle(){
            echo do_shortcode('[dark-mode-toggle]');;
    }
    

    Note: I did have to style it by floating it to the right and padding it a bit... but it works great.
    screenshot

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble