Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

No default setting for "Mobile navigation layout" #1200

Closed
joelworsham opened this issue Dec 29, 2017 · 5 comments
Closed

No default setting for "Mobile navigation layout" #1200

joelworsham opened this issue Dec 29, 2017 · 5 comments
Labels

Comments

@joelworsham
Copy link

How can this bug be reproduced?

  1. Create a fresh install of WordPress with this theme activated.
  2. Do not go to the Customizer and modify the "Mobile navigation layout" option.

What did you expect to happen?

I expect that, by default, the mobile menu uses the topbar layout. I expect this because if you visit the Customizer, without ever changing a setting, it is the initially checked radio field.

What happened instead?

The mobile navigation is broken entirely because there is nothing yet saved into the theme_mod, and the code that displays either/or mobile menu requires one of the 2 options to be saved to the database. In other words, it does not anticipate a default value.

Please List the Following:

  • OS & version: OSX 10.13.2
  • Node version (node -v) [Node v4+ is required] : 8.6.0
  • FoundationPress version (see line 3 in package.json): 2.10.4
  • Foundation version (found in node_modules/foundation-sites/package.json) : 6.4.3
@colin-marshall
Copy link
Collaborator

<?php if ( ! get_theme_mod( 'wpt_mobile_menu_layout' ) || get_theme_mod( 'wpt_mobile_menu_layout' ) === 'topbar' ) : ?>
    <?php get_template_part( 'template-parts/mobile-top-bar' ); ?>
<?php endif; ?>

@joelworsham that conditional in header.php should account for no setting being saved. I'll do some testing to figure out what's going on.

@linuxbastard
Copy link
Contributor

Just tested this on a new site.
Ubuntu 16.04
PHP 7.1
Node 8.9.4/npm 5.6
Latest WordPress, only default themes and FoundationPress

The top bar doesn't activate if you don't have a menu designated for mobile, otherwise it works as expected.

@joelworsham
Copy link
Author

There is conflicting code. The line you showed in header.php does, in fact, account for a default. It defaults to the topbar:

https://github.com/olefredrik/FoundationPress/blob/master/header.php#L45-L47

The issue is, there is one other place that considers the offcanvas the default. It is here:

https://github.com/olefredrik/FoundationPress/blob/master/library/custom-nav.php#L63-L67

This means that, if you have no theme_mod saved for wpt_mobile_menu_layout, it will default to topbar in one place and offcanvas in another. Unless I'm misinterpreting something here, but I can confirm that the menu was definitely broken until I made a selection in the Customizer.

@colin-marshall
Copy link
Collaborator

Good find @joelworsham! Care to put in a pull request? What do you guys think the default should be?

@joelworsham
Copy link
Author

I'll see if I can get a chance! My vote would be topbar.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants