Last active
October 15, 2022 06:41
-
-
Save wpflames/6e42fda90c063e1154e8aa96830840ce to your computer and use it in GitHub Desktop.
Hamburger menu for WordPress custom theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @import "menu/menu"; | |
| // Site Header | |
| /************************************/ | |
| .site-header { | |
| font-family: $font-primary; | |
| // Mobile menu | |
| .site-header-navigation { | |
| display: flex; | |
| @media (min-width: $md) { | |
| display: none; | |
| } | |
| } | |
| // Desktop menu | |
| .menu-desktop-menu-container{ | |
| display: none; | |
| @media (min-width: $sm){ | |
| width: 80%; | |
| } | |
| @media (min-width: $md){ | |
| display: flex; | |
| align-items: center; | |
| } | |
| @media (min-width: $lg) { | |
| margin-right: 30px; | |
| } | |
| .desktop-menu{ | |
| display: flex; | |
| justify-content: flex-end; | |
| align-items: center; | |
| margin: 0; | |
| width: 100%; | |
| .menu-item{ | |
| list-style: none; | |
| margin: 0 10px; | |
| a{ | |
| color: black; | |
| text-decoration: none; | |
| } | |
| } | |
| } | |
| } | |
| &-top{ | |
| padding: 10px; | |
| background: $blue-dark; | |
| display: none; | |
| @media (min-width: 1180px) { | |
| display: block; | |
| } | |
| &-wrap{ | |
| padding: 0 35px 0 30px; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| margin: auto; | |
| max-width: 1400px; | |
| } | |
| &-customer-service { | |
| color: white; | |
| &-txt{ | |
| display: none; | |
| @media (min-width: 1180px) { | |
| display: inline-block; | |
| } | |
| } | |
| &-link{ | |
| color: white; | |
| } | |
| } | |
| &-nav{ | |
| color: $blue-light; | |
| display: flex; | |
| align-items: center; | |
| &-list{ | |
| margin: 0; | |
| display: flex; | |
| justify-content: flex-end; | |
| gap: 30px; | |
| .menu-item{ | |
| list-style: none; | |
| a{ | |
| text-decoration: none; | |
| color: $blue-light; | |
| &:visited{ | |
| color: $blue-light; | |
| } | |
| } | |
| } | |
| } | |
| &-link{ | |
| color: $blue-light; | |
| text-decoration: none; | |
| color: white; | |
| } | |
| } | |
| } | |
| &-main{ | |
| display: flex; | |
| justify-content: space-between; | |
| @include wrap; | |
| margin: 20px 0; | |
| } | |
| &-wrap { | |
| display: flex; | |
| justify-content: space-between; | |
| max-width: 1400px; | |
| @media (min-width: $md) { | |
| margin: auto; | |
| } | |
| } | |
| &-branding { | |
| @media (min-width: $md) { | |
| width: 20%; | |
| display: flex; | |
| align-items: center; | |
| } | |
| &-logo{ | |
| width: 230px; | |
| padding: 0 20px; | |
| position: relative; | |
| z-index: 9; | |
| display: block; | |
| margin: 10px 0; | |
| } | |
| } | |
| #site-navigation { | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| margin: auto; | |
| max-width: 1400px; | |
| text-transform: none; | |
| ul#menu { | |
| display: flex; | |
| li.menu-item { | |
| @media (min-width: $md){ | |
| margin: 0; | |
| } | |
| a { | |
| color: black; | |
| padding: 20px 15px; | |
| position: relative; | |
| transition: all 0.5s; | |
| font-weight: 600; | |
| &:after { | |
| transition: all 0.5s; | |
| position: absolute; | |
| bottom: 0; | |
| left: 0; | |
| right: 0; | |
| margin: auto; | |
| width: 0%; | |
| content: "."; | |
| color: transparent; | |
| background: $blue-dark; | |
| height: 2px; | |
| } | |
| &:hover { | |
| color: $blue-dark; | |
| } | |
| &:hover:after { | |
| width: 100%; | |
| } | |
| } | |
| ul.sub-menu { | |
| li { | |
| margin: 0 10px; | |
| } | |
| } | |
| &.current-menu-item { | |
| a { | |
| color: black; | |
| } | |
| ul.sub-menu { | |
| a { | |
| color: black; | |
| } | |
| } | |
| } | |
| } | |
| ul.sub-menu { | |
| background: $grey-100; | |
| display: block; | |
| li { | |
| position: relative; | |
| a { | |
| border-bottom: 1px solid rgba(255, 255, 255, 0.3); | |
| color: black; | |
| padding: 10px 0; | |
| font-weight: 300; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function mobile_menu(){ require get_theme_file_path('components/core/header/menu/menu-mobile.php'); } | |
| function secondary_menu(){ require get_theme_file_path('components/core/header/menu/menu-secondary.php'); } | |
| function desktop_menu(){ require get_theme_file_path('components/core/header/menu/menu-desktop.php'); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment