Custom Menu selected keep link - help

Hi guys

When using the custom menu what do I need to add or modify to enable the selected/active item in the menu to keep its link?

I had a look in the printCustomMenu function but cannot work out where I need to add the necessary code (to build my own custom function) to keep the link for things like the main news page or the selected album etc

Please help

Thanks

GW

Comments

  • I may not be clear on what you are asking. But it sounds like you want to do highlighting of the active menu item. If so, this is done via your them CSS. Generally speaking, the items in the "chain" have a CSS class of `menu-active-`n. N is the level "above" the current page. So the immediate parent is -1, etc.

    If you just want to add things to the menu, you do that via the add item tab. You can make a menu item which invokes a function as one of the options if that is what you are getting at. Of course, there are specific selections to make a menu item for things like the main news page.
  • Thanks for the reply, however not quite understanding me I think, let me explain.

    I am using the Custom menu option and I am building a menu, one of the menu items is the 'zenpagenewsindex' which then provides me with a menu item to go to the News index page, great. However when I go to that page via that link it brings the page up but the menu item is no longer linked, it has a class of 'menu_zenpagenewsindex' and no active or inactive call. How can I retain the link around the menu item even if it is selected?

    The same thing happens when I have an 'album' menu item as well.

    Thanks

    GW
  • acrylian Administrator, Developer
    Well, from the usability point of view it does not really make sense to link to the page you are already on. That is why these entries are not linked then.
  • While I understand that and I know what you mean, that still does not help me solve my issue, there must be a way I can tweak the code somewhere to allow me to have it keep the link.

    Thanks

    GW
  • Well, just change the printCustomMenu() function. Seriously, you may think this is a good idea. Fine. But do not expect us to help you in your ignorance.
  • 'Seriously, you may think this is a good idea. Fine. But do not expect us to help you in your ignorance.'

    Hey, that was un-called for and not necessary.

    Nothing to do with ignorance at all. Why does wanting to keep the link there ignorance?

    I simply asked a question to fit my situation and that was it. There are many questions raised on these forums that you might not agree with what is being asked for and hence why they are not default in ZP, but they are still asked, are you always this way to everyone?.

    Also yes I found the printCustomMenu function as I said in my original post, I just could not find what to edit to make it work as 'I' wanted it to.

    But it would seem I am not going to get any help by your response.

    Thanks

    GW
  • Don't get offended gwmbox, this is a common response from the developers (most of the time rightfully so), when a user dosn't attempt to customize to their needs themselves. You might get a better response if you at least post some code of your attempt, or provide a link to demonstrate your attempt and issue.

    With that being said, I agree with you on this one. I will attempt to argue the case without pissing off the developers...(wish me luck :))

    When styling an unordered list as a menu, it is much more common place, and easier to style a tag inside of the li. whether it be a span or anchor, or both. It is very difficult to style the "active" link when it is just text inside a li. It forces you to apply css rules directly to the li, which will then affect all the li in the list.

    I have many of times, made custom functions just in order to add a anchor tag or span tag inside of the list items for ease or even ability of styling.

    My two cents - :)
  • Hi gjr thanks for your comments, while I try not to get offended the response certainly came across that way.

    You are precisely right in that the text within the 'li' tags does need to have something that can be styled, hence why I have asked for the link to remain as at least then I can style the 'a' tag within the 'li' elements of the menus, if there was a span in there then that would have been sufficient.

    As for specific code I have made a copy of the printCustomMenu and renamed it in the themes functions.php file and then ensured that this new name is being called, I just don;t know where or what to edit within that to achieve what I have asked for.

    I can't provide a link yet as it is not yet online, it is on my development box next to me until the site is done.

    Thanks

    GW
  • I ended up sorting it out by creating my own menu file and including it that way and adding within that the calls to the News and Gallery using the ZP standard functions i.e. printAlbumMenuList () which has resulted in what I wanted.

    Having said that this is not the ideal solution, surely as gjr has said just add a span around the default menu items and all would be good for anyone to use and style as they wish, this includes the custom menu items.

    Thanks

    GW
  • acrylian Administrator, Developer
    Well, sbillard is sometimes a little thin skinned but sorry to say you would be if you were here for the same time as we as well.

    If any standard function we did for a reason explained does not fit your needs and we don't agree just do your own.

    It is very well possible to style the `` directly without affecting the `` with anchors or else. There are also css classes for the different menu items attached that let you differ between certain item types.

    However, I often write my own menu functions as well if I have a site with a fixed menü requirement. Easier for the client (and me) as he can't "mess" around with it...;-)
  • Thanks acrylian for your reply, while I understand that running a site like this can be testing at times, it does not really excuse the manner in which the lead (chief) developer replies to others, especially as it would seem it is not the first time, maybe a break is needed.

    Having said that I did feel that it was out of character for the ZP developers as a whole, and it has tarnished my ... what do you call it... i don't know.. impressions, no not the right word..., anyway does not matter now as I have sorted it out by writing my own menu similar to what you suggested and that works for me at this stage.

    As for being able to style the li item, sorry it is too clumsy and not an effective way to manage styles of menu items, there needs to be an internal element to the li tags to enable this to function more effectively i.e. add a span around the text.

    thanks

    GW
  • acrylian Administrator, Developer
    Well, sometimes you answer inbetween and as always written text on the net easily leads to understanding that are not meant exactly that harsh

    Sorry, I don't agree with the span. `li.someclass` vs `li.someclass > a` I find not really that clumsy.

    Anyway, just as you did special needs might require special custom solutions. Maybe we just don't understand exactly what you are doing. Try to convince and maybe show your site later.
  • Not span > li, but li > span is what we mean, so it would be li > span > a for those with links and li > span for those without.

    Cheers

    GW
  • acrylian Administrator, Developer
    I am sorry, I don't see the difference right now. If you define `li.class`and `li.class > a` you can independently style elements with link and without, even differently depending on the menu item type. But maybe I am just blind to see what the problem is.
  • The problem is the styling of the li element has an effect on all li elements, whereas you can refine the styling to specific spans if needed... or at least that is how I see it.

    The differences;
    what we have now
    li > text
    li > a.class > text

    what is being suggested
    li > span.class > text
    li > span.class > a.class > text

    is that clearer?

    Thanks

    GW
  • Here is a typical menu from menu manager
    ` `
    Just what is missing there? There are pleanty of classes to trigger from. There is absolutly no need for spurrious span tags.
  • Agree to disagree.... I guess that is the end of that then.....

    GW
  • acrylian Administrator, Developer
    Well, I think I just found out what your problem might be. Is it maybe that you want to use individual background images/colors for certain menu elements? That would indeed be not possible with our current html as that indeed would affect all the li element encloses if nested.

    That would be reasonable to have a span element I guess.
  • Correct, that and so many other options become available with adding a span element.... I guess you could have it set to include or not to include a span if that helps those that don't want them :)

    Cheers

    GW
  • acrylian Administrator, Developer
    I think it would be reasonable to include such a span then since it does nothing. We will again talk about that later.
Sign In or Register to comment.