I know I sound like a noob (that may be because I am...) but I have come back to a modx site that I am working on and hit a hurdle.
I want to create a unique id (say id="selected") when the page is being viewed within the [[nav snippet]], I have not used wayfinder to create the nav it has been hard coded using [~page id~] can anyone point me in the right direction.
As you can all guess this is simply to highlight the nav location using CSS, it was a client request post build and I don’t feel like totally recreating the [[nav snippet]] using wayfinder because the client has made so many changes I think that it would be a nightmare.
Thanks in advance
SW
I think you will get better help if you post the code to the "nav snippet" since I am not sure how that works. In any case to accomplish this you need to do some logic to identify the current document as well as identify it in the menu in order to add the style information. Depending on the snippet code a simple if() statement will handle that.
Wayfinder will add the selected class automatically. Have you tried using Wayfinder?
I don’t have a specific answer for you, but I can say that whenever I’ve converted an existing PHP menu to Wayfinder, I’ve been really glad I did it.
This is especially true for sites where the client makes a lot of changes.
Thanks for the replies. I am about to start work on this project again so if anyone has any further tips it would be fantastic and much appreciated.