I would like to make active links on my menu.php, with tags. Actually, it’s working perfectly when I’m filtering my projects in my projects.php. My menu.php looks like that :
I just want to put active class to my tag-links when viewing specific project. For example, you click to one project, and every tags corresponding could be « activated » in the menu.
Am I clear ? You can check my example here :
I will probably edit this post, once finish, to delette the link. Every help will be appreciated, Thanks
// get tags of active page
$pageTags = $page->tags()->split();
// check if the tag is in the array of $pageTags
if(in_array($tag, $pageTags)) {
// class active
}
Thank you for your response, but I can’t make your code work because some code is missing. I’m a newbie, and I don’t know how to integrate if(), and I think a “)” is missing too after $pageTags). Do I have to put <?php before ? I’m so lost, sorry.
Could you please rewrite the code more in detail ? Thx