submenu — mark first level as active
-
that would be nice, thanks.
The site is still in development, so can I send the link in private? -
can I? :)
-
can you send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com?
-
thanks, I did so
-
so by looking at your website, it seems that you dont use submenus.
solution 1:
you have a menupoint "projekte".
this is a page.if it was a category page in "wp-admin" -> "projects" -> "categories"
create a category called "projekte" or rename the default category to "projekte"
now make sure to assign this category to all existing projects.now in "wp-admin" -> "projects" -> "categories", click on the category "projekte"
in here, you will have a gridder. put your thumbnailgrid here or whatever you want.now in "appearance" -> "menus", in your menu use the newly created category page instead of a normal page
now whenever you're in a project that uses this category, that menupoint will be active.
alternative solution 2:
<script> window.laytheme.on('newpageshown', function(e){ if(jQuery('body').hasClass('type-project')) { jQuery('.menu-item-18').addClass('current-menu-item'); } }); </script>
your menu item that is the projects menu item has a html class of "menu-item-18". I found this out by using the chrome inspector. Every browser has an html inspector tool.
We can add the class "current-menu-item" to it, whenever we're on a project type page. This is what the script does.
Enter this css in "lay options" -> "custom css & html" -> "custom head content"
With solution 1 its easier to get it right if for example you have multiple types of project categories and multiple menu items that should stay activated when you're in a project with one of these categories.
-
Thanks so far, but this would not be a solution for the whole page, I think?! Maybe I still missed to become clear enough:
The active "top-Menu" should be should also hav the active status, when the sub-site is active, on all sub-pages on the site, such as on e.g. "büro". They are all listed as "sub-sites" in the admin-area.
Meaning when I open the page "team" — which is a subset to "Büro" — the according top-menu-item "büro" should be set as "active, in this case 50% grey.
Can you have a look, thanks. -
<script> window.laytheme.on('newpageshown', function(e){ if(jQuery('body').hasClass('type-project')) { jQuery('.menu-item-18').addClass('current-menu-item'); } else if(jQuery('body').hasClass('type-lay_news')){ jQuery('.menu-item-15').addClass('current-menu-item'); } if(window.location.href.indexOf('/buero/') !== -1){ jQuery('.menu-item-17').addClass('current-menu-item'); } }); </script>
i inserted this script to your page this should work for now
you're right, for subpages i should make it work by default
im writing it down -
but basically its about menupoints getting the active state when we are on a subpage and the menupoint is the menupoint of a parent page.
there is no submenu here like this one: https://laytheme.com/documentation/menus.html#submenus
thats why i didnt understand the issue at first
-
but for the case "projekte" menupoint you could still use my solution 1:
http://laythemeforum.com:4567/topic/10772/submenu-mark-first-level-as-active/11however, then the permalink would be /category/projekte
not sure if u want that
-
-
thank you thank you thank you!
I will have a look at it and would be getting back to know when I have more questions.
16/16
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it