Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom menu problems in BuddyPress default and child themes

  • @andrearessell

    Participant

    Hi there
    I’ve created a custom menu for my site (http://emerge2012.net/live/), but it’s rendering incorrectly :-(
    When I compare the html output of the custom vs the standard menu, it’s obvious that the custom menu is inserting a class attribute for each menu item:
    <li id="menu-item-134" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-134">
    instead of just
    <li id="menu-item-134">
    The admin tool allows me to enter a CSS class, but this merely appends the new class instead of removing the invader! Any ideas how I can resolve this?
    I’m running WP3.3.2 and BuddyPress with the Frisco theme.
    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • @mercime

    Participant

    Add this to the wp_nav_menu array in the theme’s header.php file
    'menu_class' => '',

    @andrearessell

    Participant

    Thanks for the help, but unfortunately that didn’t do the trick. Any other recommendations?

    @mercime

    Participant

    @andrearessell … then you also add this to your theme’s functions.php file:

    // Remove classes in custom menu list
    add_filter('nav_menu_css_class', 'mme_css_attributes_filter', 100, 1);
    add_filter('page_css_class', 'mme_css_attributes_filter', 100, 1);
    function mme_css_attributes_filter($var) {
    return is_array($var) ? array_intersect($var, array('current-menu-item')) : '';
    }
    
    // Remove empty classes in custom menu list
    function mme_remove_empty_classes($menu) {
    $menu = preg_replace('/ class=""| class="sub-menu"/','',$menu);
    return $menu;
    }
    add_filter ('wp_nav_menu','mme_remove_empty_classes');

    @andrearessell

    Participant

    Thanks so much for your help. The extra classes are gone now, but the menu is still showing up as a bullet list.

    @mercime

    Participant

    == The extra classes are gone now, but the menu is still showing up as a bullet list. ==

    The menu was never rendered as bullet list so I don’t understand what you mean that it “is still showing up as bullet list.” The latest version of Frisco theme is version 1.5.04 so do make sure that’s the version you’re using.

    Also, make sure that you didn’t delete anything from the navigation menu in your theme’s header.php. You can compare it with theme’s original header.php file – https://themes.svn.wordpress.org/frisco-for-buddypress/1.5.04/header.php

    If you made any changes to the stylesheet, then re-upload theme’s original style or copy over . https://themes.svn.wordpress.org/frisco-for-buddypress/1.5.04/style.css

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom menu problems in BuddyPress default and child themes’ is closed to new replies.
Skip to toolbar