• Skip to main content
  • Skip to primary sidebar

Victor Font Consulting Group, LLC

The DEX Intranet Specialists

  • Home
  • Care Plans
    • Care Articles
    • Optional Subscriptions
  • Consultations
  • Products
    • Code Snippets
    • Public GitHub Repositories
    • Gist Snippets
    • Pastebin Snippets (Free)
    • Free Plugins
  • FAQs
  • Support
    • Graphic Design
  • Contact
    • Speakers
    • Portfolio
  • Resources
    • Free WordPress Video Training
    • Tutorials
    • Articles
    • Cybersecurity
    • EU Referral Network

Genesis Mobile Responsive Custom Menu Widget

April 10, 2014 By Victor M. Font Jr.

Mobile Responsive Custom Menu Widget

Many Genesis Framework users opt to use the Custom Menu Widget in the Header Right Widget Area instead of the standard primary and/or secondary menu locations built into your theme if they are supported at all. The problem you will encounter with the Custom Menu Widget is that it does not generate a mobile responsive menu. This can be a big problem, especially with the vast numbers of mobile users accessing our sites. In fact, I've seen numerous questions in forums asking how to make the Custom Menu Widget mobile responsive. The questions I've reviewed have remained unanswered.

This tutorial is a direct result of a requirement for one of my clients, Blue Olive Strategic Solutions. I recently built a new child theme for one of Blue Olive's customers, American RX. The design required me to place the primary navigation menu in the Custom Menu Widget in the Header Right area. Blue Olive asked for a typical mobile responsive hamburger menu when viewed on small mobile screens. It took a while, but I solved the problem. This tutorial will teach you how to make the custom menu widget mobile responsive. It may not solve your problem completely, but it will certainly get you on the right track.

The crux of the problem lies in the fact that Genesis responsive menus require that the menu be assigned to the primary and/or secondary theme locations. When the markup is created, the HTML wrappers have the class of nav-primary or nav-secondary. It's relatively easy to hook into the primary or secondary navigation areas. But when the menu is generated in the Custom Menu Widget, it has a class called nav-header. There aren't any built-in hooks for the nav-header class, at least none that I can find.

Before we get into the code, there are a few things that need explanation. First, I use the Dynamik Website Builder from CobaltApps to build my child themes. The Dynamik Website Builder generates its own code to create mobile responsive menus. I generally choose a vertical toggle style menu. When using the primary and secondary menu locations, the generated code, inserts a section of div tags before the nav-primary and nav-secondary elements. These div tags are what drives the menu toggle.

Second, I am not providing the code generated by Dynamik Website Builder. There are dozens of examples and plenty of source code available for mobile responsive menus. You've probably already gotten your own favorite code that you use with your sites. This tutorial will point you in the right direction for integrating your own code so the Custom Menu Widget is mobile responsive.

Third, I am assuming that you do not have a menu assigned to your theme's primary location.

With those points out of the way, here's the code:

What we're doing here is to replace the genesis_do_header function with our own custom header function. This function is essentially the core genesis_do_header function with some slight modifications. What makes this code work for my theme is the last function, vmf_genesis_header_menu_wrap. The native genesis_header_menu_wrap function does one thing, it creates the HTML markup for any menu assigned to the Custom Menu Widget in the Header Right Area. The following is the code for the native genesis_header_menu_wrap function.

This is where the nav-header markup is created. In the customized code, I added some additional markup required by the Dynamik Website Builder code and also changed the menu markup from nav-header to nav-primary. This works great on the client's site. I hope it helps you move in the right direction with your theme.

  • 4shares
  • Facebook0
  • Twitter0
  • Pinterest0
  • LinkedIn2
  • Print
  • SMS2

Filed Under: Code Snippet, Computers and Internet, Genesis, Programming Tagged With: Code Snippet, Computers and Internet, Genesis, Programming

About Victor M. Font Jr.

Victor M. Font Jr. is an award winning author, entrepreneur, and Senior IT Executive. A Founding Board Member of the North Carolina Executive Roundtable, he has served on the Board of Advisors, of the North Carolina Technology Association, the International Institute of Business Analysis, Association of Information Technology Professionals, Toastmasters International, and the North Carolina Commission for Mental Health, Developmental Disabilities, and Substance Abuse Services. He is author of several books including The Ultimate Guide to the SDLC and Winning With WordPress Basics, and Cybersecurity.

Primary Sidebar

Shopping Cart

Books

  • Ultimate Guide to the SDLC front cover The Ultimate Guide to the SDLC
    Rated 5.00 out of 5
    $74.95
  • Winning With WordPress Basics 2nd Edition Winning With WordPress Basics 2nd Edition $19.95

Recent Articles

  • Modern Scam Defense: How Consumers and Businesses Can Recognize and Stop Email, Phone, and Text Fraud
  • How to Write a PRD So Dense It’s Technically a Novel
  • Top 5 Plugin Names That Scare Our Legal Department
  • When Agile Meets Our 3-Year Waterfall Roadmap: A Love Story
  • Why Our Enterprise Needs 27 Stakeholders to Approve a Button Color Change

Top 10 Article Categories

Best Practice Code Snippet Computers and Internet Genesis How To Leadership Programming Servant Leadership Tutorial WordPress

 
We only use analytical cookies on our website that allow us to recognize and count the number of visitors, but they do not identify you individually. They help us to improve the way our website works. By clicking Accept you, agree to cookies being used in accordance with our Cookie Policy.