Advertisement
maya-nikolova

Bricks nav menu descriptions

Jan 6th, 2023
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. //php used to show the descriptions
  2. <?php
  3. add_filter('walker_nav_menu_start_el', 'add_description_to_menu_item', 10, 4);
  4.  
  5. function add_description_to_menu_item($item_output, $item, $depth, $args) {
  6. if ( !empty($item->description)) {
  7. $item_output .= '<span class="menu-item__description">' . $item->description . '</span>';
  8. }
  9. return $item_output;
  10. }
  11.  
  12. /*css styles the WP Nav menu descriptions*/
  13. .menu-item__description {
  14. color: var(--shade-ultra-light);
  15. font-size: var(--text-s);
  16. font-weight: 200;
  17. display: block;
  18. padding: 10px 40px 30px 40px;
  19. margin-top: -20px;
  20. line-height: 1.2;
  21. }
  22.  
  23. /*makes submenu container text wrap at min 300px*/
  24. .brxe-nav-menu .bricks-nav-menu .sub-menu {
  25. white-space: normal;
  26. min-width: 300px;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement