Jump to content


Photo
- - - - -

custom menu class


  • Please log in to reply
5 replies to this topic

#1 Guido

Guido

    Advanced Member

  • Members

  • 48 posts
  • Country: Country Flag

Posted 19 January 2013 - 05:52 PM

Hi,

 

i want to change the class which is given to a menu by default. I think it is part of wp_nav_menu - but i dont know where to find it in pagelines. Anyway i would prefer to make the change in the function.php (if possible?)

 

I need it for a custom WP menu in the sidebar - now the html appears like this:

Please Login or Register to see this Hidden Content

 

 

I want to change it into that:

Please Login or Register to see this Hidden Content

 

 

Can this class be changed in the functions.php?



#2 Danny

Danny

    Is Awesome!

  • Moderators
  • 15084 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 20 January 2013 - 11:14 AM

Hi,

 

What you're referring to is the standard Wordpress Custom Menu widget, when you name your menu, that name is added as a class to that widget, see my images below for an example.

 

1. 

Please Login or Register to see this Hidden Content

2. 

Please Login or Register to see this Hidden Content

3. 

Please Login or Register to see this Hidden Content

 

As you can see the HTML looks like this:

Please Login or Register to see this Hidden Content

If this suggestion isn't what you're looking for then you will need to ask this question on the Wordpress support forums, as this is a Wordpress widget and not related to PageLines.



#3 Guido

Guido

    Advanced Member

  • Members

  • 48 posts
  • Country: Country Flag

Posted 20 January 2013 - 01:01 PM

Your suggestions lead to aply a class to single menu-items. I want to apply custom css to a the entire ul. Therefore I changed the default wp class name in the nav-menu-template.php and it works fine.
I replaced 'menu' with 'nav nav-tabs nav stacked' and pagelines applies the bootstrap design to the standard Wordpress Widget Menu, which is a big deal for me.

 

But i need to get it into the functions.php...  and yes, you are right - thats a Wordpress question at least. ;-)



#4 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 22 January 2013 - 04:33 AM

Hi,

 

What do you need to get into functions.php? Couldn't you use the functions.php found in the PageLines Customize plugin or in a child theme?



#5 Guido

Guido

    Advanced Member

  • Members

  • 48 posts
  • Country: Country Flag

Posted 22 January 2013 - 08:19 AM

There is a snippet in the nav-menu-template.php on line 136:

 

Please Login or Register to see this Hidden Content

 

 

I replaced the default Wordpress menu class to a class provided by bootstrap:

 

'nav nav-tabs nav-stacked'

 

Now i want to move this code into the functions.php to make it update save.



#6 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 22 January 2013 - 01:54 PM

From the docs at: 

Please Login or Register to see this Hidden Content

 

you can use the filter wp_nav_menu_args

 

 

Please Login or Register to see this Hidden Content

 

Please Login or Register to see this Hidden Content

and change it to do what you want