Member
Member
davidarnoult   2019-03-30, 20:48
#1
Hi,

I would like to use menu_manager extension function to create a navbar for bootstrap.
I need to have this structure with a class to ul:
[code]
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Médiathèque</a>
</li>
...
</ul>
[/code]

However printCustomMenu only offers the possibility to specify en id of the ul. I tried this:
[code]
<?php printCustomMenu('menu_0','list','navbar-nav', 'nav-item active', 'nav-item', 'nav-item active', '0' ); ?>
[/code]

Which produces:
[code]
<ul id="navbar-nav">
<li class="menu_galleryindex nav-item active">Home</li>
...
</ul>
[/code]
Is there a way to define the class for the ul element of affects the navbar-nav class using an ID?

Thanks

David
Administrator
Administrator
acrylian   2019-03-31, 10:22
#2
I fear not without modifying `printCustomMenu()` respectively creating your own custom version of it.

There is simply no class setup for the ulsince you technically can achieve everything by using the css cascade. Nowadays I would not use an id but changing this will result in compatibility issues naturally.
This kind of inflexibility by predefined requirements is a drawback of frameworks like bootstrap as usefull as they might be (and why I personally don't use such frameworks actually).

You could add a class via JS but not sure if that can be considered reliable.
Member
Member
vincent3569   2019-03-31, 21:19
#3
are you using zpBootstrap?
the theme doesn't support this plugin, and I am working on it.
Member
Member
davidarnoult   2019-04-01, 19:18
#4
Hi!

@acrylian: Thank you, it is clear. How can I create /xclass my own version of it? Do I need to copy it in functions.php of my theme?

@vincent3569: Yes, I tried your theme which is very good indeed. Actually I am working on my own theme based (simpler one) including bootstrap v4 and wish to support menu_manager plugin too. If you work on this feature, I will obviously keep an eye on your development or we could share some work too?
Administrator
Administrator
acrylian   2019-04-02, 08:04
#5
> Thank you, it is clear. How can I create /xclass my own version of it? Do I need to copy it in functions.php of my theme?

Yes, copy the function to your theme's functions.php and rename it. Also add a check that the plugin is enabled so the site does not directly break if not.
Member
Member
vincent3569   2019-04-02, 13:24
#6
@davidarnoult
Keep one eyes on my github repository: https://github.com/vincent3569/zpBootstrap
I made the improvements on requested files (front end and admin) and I have to do some tests before commit.
Member
Member
davidarnoult   2019-04-04, 05:38
#7
Thank you both for your support. I will check and test it when I will find some time...
Member
Member
vincent3569   2019-05-29, 07:07
#8
hi
@davidarnoult: zpBoostrap now supports menu_manager plugin.
you can have a look on my github repository: https://github.com/vincent3569/zpBootstrap
Administrator
Administrator
acrylian   2019-05-29, 07:19
#9
Btw, a good solution to workaround the missing class on the menu `[list]` itself. The proper semantic HTML5 setup for a menu would be this:

<nav> //here you can easily add your own class and then use the cascade to style
<ul>
[*]…
[/list]
</nav>
Member
Member
vincent3569   2019-05-29, 15:27
#10
I use a `<nav>...</nav>` tag to wrap all the complex menu statements of my theme
Administrator
Administrator
acrylian   2019-05-29, 15:33
#11
@vincent3569 Good! It was just a follow up suggestion that we don't really need to add yet another parameter to the main menu function.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.