Advertisement
ten80snowboarder

WordPress Flyout Nav Menus

May 4th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. === PHP in the FUNCTIONS.PHP to register the menus ===========
  2. function register_my_menus() {
  3. register_nav_menus(
  4. array(
  5. 'header-menu' => __( 'Header Menu' ),
  6. 'footer-menu' => __( 'Footer Menu' )
  7. )
  8. );
  9. }
  10. add_action( 'init', 'register_my_menus' );
  11.  
  12.  
  13. === PHP in the template where you want the menu to display ===
  14. <nav id="access">
  15. <?php
  16. $args = array(
  17. 'theme_location' => 'header-menu'
  18. );
  19. wp_nav_menu( $args );
  20. ?>
  21. </nav>
  22.  
  23.  
  24. === CSS to style the menus - change this as needed ===========
  25. /* =Menu
  26. -------------------------------------------------------------- */
  27. #access {
  28. background: #222; /* Show a solid color for older browsers */
  29. background: -moz-linear-gradient(#252525, #0a0a0a);
  30. background: -o-linear-gradient(#252525, #0a0a0a);
  31. background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#252525), to(#0a0a0a)); /* older webkit syntax */
  32. background: -webkit-linear-gradient(#252525, #0a0a0a);
  33. -webkit-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 2px;
  34. -moz-box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 2px;
  35. box-shadow: rgba(0, 0, 0, 0.4) 0px 1px 2px;
  36. clear: both;
  37. display: block;
  38. float: left;
  39. margin: 0 auto 6px;
  40. width: 100%;
  41. }
  42. #access ul {
  43. font-size: 13px;
  44. list-style: none;
  45. margin: 0 0 0 -0.8125em;
  46. padding-left: 0;
  47. }
  48. #access li {
  49. float: left;
  50. position: relative;
  51. }
  52. #access a {
  53. color: #eee;
  54. display: block;
  55. line-height: 3.333em;
  56. padding: 0 1.2125em;
  57. text-decoration: none;
  58. }
  59. #access ul ul {
  60. -moz-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
  61. -webkit-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
  62. box-shadow: 0 3px 3px rgba(0,0,0,0.2);
  63. display: none;
  64. float: left;
  65. margin: 0;
  66. position: absolute;
  67. top: 3.333em;
  68. left: 0;
  69. width: 188px;
  70. z-index: 99999;
  71. }
  72. #access ul ul ul {
  73. left: 100%;
  74. top: 0;
  75. }
  76. #access ul ul a {
  77. background: #f9f9f9;
  78. border-bottom: 1px dotted #ddd;
  79. color: #444;
  80. font-size: 13px;
  81. font-weight: normal;
  82. height: auto;
  83. line-height: 1.4em;
  84. padding: 10px 10px;
  85. width: 168px;
  86. }
  87. #access li:hover > a,
  88. #access ul ul :hover > a,
  89. #access a:focus {
  90. background: #efefef;
  91. }
  92. #access li:hover > a,
  93. #access a:focus {
  94. background: #f9f9f9; /* Show a solid color for older browsers */
  95. background: -moz-linear-gradient(#f9f9f9, #e5e5e5);
  96. background: -o-linear-gradient(#f9f9f9, #e5e5e5);
  97. background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f9f9f9), to(#e5e5e5)); /* Older webkit syntax */
  98. background: -webkit-linear-gradient(#f9f9f9, #e5e5e5);
  99. color: #373737;
  100. }
  101. #access ul li:hover > ul {
  102. display: block;
  103. }
  104. #access .current-menu-item > a,
  105. #access .current-menu-ancestor > a,
  106. #access .current_page_item > a,
  107. #access .current_page_ancestor > a {
  108. font-weight: bold;
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement