• 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

Loading responsive nav js in header

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 › Loading responsive nav js in header

This topic is: not resolved

Tagged: $in_footer, monochrome pro, nav menu

  • This topic has 4 replies, 2 voices, and was last updated 6 years, 3 months ago by Brad Dalton.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • August 14, 2019 at 5:18 am #492972
    photoaddictsa
    Member

    I know loading javascript in the header is a bit of a no-no, I mainly want to do this as a test to see if it will get rid of the brief desktop nav flash on tablets and mobile.

    How would I go about loading the responsive nav js (/theme/js/responsive-menus.min.js?ver=1.0.0) in the head instead of foot?

    I'm using monochrome pro.

    https://sparec.co.za/
    August 14, 2019 at 5:40 am #492973
    Brad Dalton
    Participant

    Find the PHP code in functions which loads the menu and change the 5th parameter $in_footer for wp_enqueue_script to false https://developer.wordpress.org/reference/functions/wp_enqueue_script/#parameters

    Line 80

    wp_enqueue_script( 'monochrome-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menus' . $suffix . '.js', array( 'jquery' ), CHILD_THEME_VERSION, false );
    

    Tutorials for StudioPress Themes.

    August 14, 2019 at 6:04 am #492974
    photoaddictsa
    Member

    Thanks Brad,

    The js loaded as I wanted but my theory failed. Seems like when you load the js in the head the responsive menu does not load at all.

    I know the desktop nav flashing briefly before the responsive nav is a small issue but seems to annoy certain folks.

    Do you perhaps know of a workaround solution for that problem (It's also described here: https://github.com/studiopress/genesis-sample/issues/102)

    August 14, 2019 at 11:51 pm #492993
    Brad Dalton
    Participant

    Looks like the code for the menu needs to be rewritten because the full menu loads at all widths.


    Tutorials for StudioPress Themes.

    August 15, 2019 at 12:03 am #492994
    Brad Dalton
    Participant

    Maybe using jQuery to hide the desktop menu on mobiles might work rather than pure CSS.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 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

© 2025 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