Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • 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 1.3k Views 2 Watching
  • 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.
  • arminunruhA
    arminunruhA
    arminunruh
    Global Moderator
    wrote on last edited by
    #2

    thats a good idea
    im writing it down.

    at the moment thats not how it works but i should code that yea.

    so at the moment if you have projects inside of a submenu, if you want the main menu point to be activated,
    you could create a category page in "projects" -> "categories". in here, you can also add things to the gridder when you click on a category.

    then assign this category to your projects.
    put the category menu point inside your menu

    then whenever you're inside a project that this category is used for, the category menu point will still be active

    1 Reply Last reply
    0
    • B
      B
      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
        arminunruhA
        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
          B
          bbbfg
          wrote on last edited by
          #5

          great! :)
          Thanks a lot

          1 Reply Last reply
          0
          • arminunruhA
            arminunruhA
            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
              B
              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
                B
                bbbfg
                wrote on last edited by
                #8

                can I? :)

                1 Reply Last reply
                0
                • arminunruhA
                  arminunruhA
                  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
                    B
                    bbbfg
                    wrote on last edited by
                    #10

                    thanks, I did so

                    1 Reply Last reply
                    0
                    • arminunruhA
                      arminunruhA
                      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
                        B
                        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
                          arminunruhA
                          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
                            arminunruhA
                            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
                              arminunruhA
                              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/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
                                B
                                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

                                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                With your input, this post could be even better 💗

                                Register Login
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                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