-
Notifications
You must be signed in to change notification settings - Fork 865
Add Customizer Option for Topbar or Offcanvas Mobile Menu #411
Add Customizer Option for Topbar or Offcanvas Mobile Menu #411
Conversation
This pull request allows the user to select the type of mobile menu they want - Topbar or Offcanvas - in the theme customizer. header.php Selectively output the code needed for an off-canvas menu. If the customizer setting is offcanvas, that code will be output. I also fixed what appears to be a bug introduced in the last merge. The $GLOBALS['offcanvasposition'] was not being echoed when called in the template. footer.php Selectively output the code needed for an off-canvas menu. library/custom-nav.php A new file creating the customizer options. also added a filter to add “offcanvas” or “topbar” classes to the body tag to help with CSS styles. functions.php calling custom-nav.php parts/top-bar.php added in the needed <li> for the mobile hamburger menu scss/site/_topbar.scss hiding .top-bar at breakpoint only if menu option is set offcanvas
Good stuff. Seems like a few build checks have failed, though. Could you have a look at it? |
Thanks, Ole. I will have a look at how to run the tests on my end to make sure I get everything fixed. |
Ole, the tests are passing now. I wasn't 100% sure about changing the the status badge to point to my repo, so if there is something else I need to do on that end, let me know. |
Add Customizer Option for Topbar or Offcanvas Mobile Menu
👍 awesome! |
As of now the off canvas position is to be set multiple places. It kind of works, but the current solution is still not ideal. On a general basis I mean it's bad practice to put settings like this in template files (such as the header or the off-canvas-menu template). It would be quite cool if we could expose the 'left' or 'right' setting for off canvas position in the theme customizer menu, instead of hard coding the off canvas position as a global variable in various php files. Any thoughts about this, @AdamChlan ? |
I was thinking the same this. I can integrate that functionality into the customizer panel. |
This pull request allows the user to select the type of mobile menu
they want - Topbar or Offcanvas - in the theme customizer.
header.php
Selectively output the code needed for an off-canvas menu. If the
customizer setting is offcanvas, that code will be output. I also fixed
what appears to be a bug introduced in the last merge. The
$GLOBALS['offcanvasposition'] was not being echoed when called in the
template.
footer.php
Selectively output the code needed for an off-canvas menu.
library/custom-nav.php
A new file creating the customizer options. also added a filter to add
“offcanvas” or “topbar” classes to the body tag to help with CSS
styles.
functions.php
calling custom-nav.php
parts/top-bar.php
added in the needed
scss/site/_topbar.scss
hiding .top-bar at breakpoint only if menu option is set offcanvas