Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. submenu — mark first level as active

submenu — mark first level as active

Scheduled Pinned Locked Moved General Discussion
16 Posts 2 Posters 137 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bbbfg
    wrote on last edited by
    #3

    Thank you.

    By ‘projects’ I actually just meant ‘any page’, it could also be ‘locations’ as the main page and ‘Berlin’, ‘Cologne’ etc. as a subpage.
    Does that make it clearer?

    1 Reply Last reply
    0
    • arminunruhA Offline
      arminunruhA Offline
      arminunruh
      Global Moderator
      wrote on last edited by
      #4

      yes! this makes total sense, i will work on it today i think

      1 Reply Last reply
      1
      • B Offline
        B Offline
        bbbfg
        wrote on last edited by
        #5

        great! :)
        Thanks a lot

        1 Reply Last reply
        0
        • arminunruhA Offline
          arminunruhA Offline
          arminunruh
          Global Moderator
          wrote on last edited by arminunruh
          #6

          hello

          so while i was checking i noticed that this seems to already work as you expected.

          can you post your website url so i can check why it might not work for you?

          customize -> menu style -> active menu point

          this style will be applied automatically to the first level menupoint whenever you're on a page of its submenu. for me that works

          1 Reply Last reply
          0
          • B Offline
            B Offline
            bbbfg
            wrote on last edited by
            #7

            that would be nice, thanks.
            The site is still in development, so can I send the link in private?

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bbbfg
              wrote on last edited by
              #8

              can I? :)

              1 Reply Last reply
              0
              • arminunruhA Offline
                arminunruhA Offline
                arminunruh
                Global Moderator
                wrote on last edited by
                #9

                can you send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com?

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  bbbfg
                  wrote on last edited by
                  #10

                  thanks, I did so

                  1 Reply Last reply
                  0
                  • arminunruhA Offline
                    arminunruhA Offline
                    arminunruh
                    Global Moderator
                    wrote on last edited by
                    #11

                    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.

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      bbbfg
                      wrote on last edited by
                      #12

                      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.

                      1 Reply Last reply
                      0
                      • arminunruhA Offline
                        arminunruhA Offline
                        arminunruh
                        Global Moderator
                        wrote on last edited by
                        #13
                        <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

                        1 Reply Last reply
                        0
                        • arminunruhA Offline
                          arminunruhA Offline
                          arminunruh
                          Global Moderator
                          wrote on last edited by
                          #14

                          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

                          1 Reply Last reply
                          0
                          • arminunruhA Offline
                            arminunruhA Offline
                            arminunruh
                            Global Moderator
                            wrote on last edited by
                            #15

                            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/11

                            however, then the permalink would be /category/projekte

                            not sure if u want that

                            1 Reply Last reply
                            0
                            • arminunruhA arminunruh referenced this topic on
                            • B Offline
                              B Offline
                              bbbfg
                              wrote on last edited by
                              #16

                              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.

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              I also code custom websites or custom Lay features.
                              💿 Email me here: 💿
                              info@laytheme.com

                              Before you post:
                              1. When using a WordPress Cache plugin, disable it or clear your cache.
                              2. Update Lay Theme and all Lay Theme Addons
                              3. Disable all Plugins
                              4. 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:
                              1. Post a link to where the problem is
                              2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                              3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                              Online Users
                              Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                              laytheme.com
                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Search