[Plugin:Menubar] Working with %name in templates (3 posts)

  1. tpohare
    Posted 5 years ago #

    I need to set menubar so that when a a Page is open a certain Category Tree has display:block assigned to it. I've gotten as far as if I'm on a page changing $default_inove but I'm changing the style on every category Tree rather than the one I want.

    Is it possible to make $name available to the template so I can assign the style to a specific Category Tree when a page is open?


  2. Andrea Tarantini
    Plugin Author

    Posted 5 years ago #

    Hello Tpohare,

    As you can see your template makes a call to wpm_out41(), so you could copy the function wpm_out41() from wpm-menu.php to your template, then change its name so it doesn't conflict with the original one.

    Now you can modify your copy of wpm_out41(). Inside that function you can access the menu item data in the standard class $item, so your modification could be something like this:

    if (is_page('My Page')) && $item->name == 'My Category Tree')
    $item->cssclass = someclass ...
    $item->attributes = some attribs ...
  3. tpohare
    Posted 5 years ago #

    Worked perfectly, thank you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Menubar
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic