Forums

[resolved] Building menu manually possible? (3 posts)

  1. kamulos
    Member
    Posted 1 year ago #

    Hi experts,

    I am really new to wordpress and I'm already stuck with the menu. I do not want all those ids and classes printed out with the menu's ul and li. I never use them, this is a waste of bytes. The container should look like this <div id='menu'>, but the class part is not removable. I even looked this up in the wordpress source code.

    In short: can I buid up the menu manually just by iterating through the nodes? This would be the easiest solution I think.

    A different problem (not important but annoying) is that creating a custom Menu requires admin rights. Different editors are creating and writing many pages, because I use wordpress as CMS. But I dont want to grant all of them admin rights. What to do?

  2. jkovis
    Member
    Posted 1 year ago #

    I do not want all those ids and classes printed out with the menu's ul and li.
    
    In short: can I buid up the menu manually just by iterating through the nodes?

    - You can specify a custom walker object for wp_nav_menu() to use.

    A different problem (not important but annoying) is that creating a custom
    Menu requires admin rights

    - The easiest thing to do is give the editor role the ability to edit theme options.

    // modify capabilities so editors can edit menus, widgets, and theme options
    $role_object = get_role( 'editor' );
    $role_object->add_cap( 'edit_theme_options' );

    The above code will allow editors to also access the widgets and any custom theme options pages (if your theme uses them). Allowing access to the menus page yet restricting the widgets and theme options pages is possible, but would require hooking into WordPress a little differently.

  3. kamulos
    Member
    Posted 1 year ago #

    big thx. All problems solved :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.