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. Feedback
  3. Separate menu items by commas instead of spacing?

Separate menu items by commas instead of spacing?

Scheduled Pinned Locked Moved Feedback
menu
21 Posts 7 Posters 3.2k 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.
  • S Offline
    S Offline
    sdg
    wrote on last edited by
    #1

    I would love to be able to separate menu items by commas. For the normal view it works to just add a comma to the navigation labels, but this messes up the mobile/tablet view, where the items are on separate lines. Is there a workaround for this?

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

      hey!

      You can use css! Pls go to "Lay Options" -> "Custom CSS & HTML" -> "Custom CSS for Desktop Version" and enter:

      nav.primary li:after{
          content: ",";
      }
      nav.primary li:last-child:after{
          content: "";
      }
      

      you might want to use a font color for the comma:

      nav.primary li:after{
          content: ",";
          color: #f0f;
      }
      
      1 Reply Last reply
      0
      • S Offline
        S Offline
        sdg
        wrote on last edited by sdg
        #3

        Oh, great! Thanks so much – my CSS skills are more modest than this. Super.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sdg
          wrote on last edited by
          #4

          So I used these commas, but they disappeared now that I updated to the most recent versions of WP/LayTheme. The CSS is still there, so I don’t understand what could be wrong. Do you have any idea? (Website in progress: www.pilvitakala.com/new/)

          1 Reply Last reply
          0
          • mariusjopenM Offline
            mariusjopenM Offline
            mariusjopen
            Global Moderator
            wrote on last edited by
            #5

            Hi Sdg!

            you need to change the code to

            nav.primary a:after {
                content: "," !important;
            }
            

            Then it should work fine.

            Let me know if it did the job!

            All the best!

            Marius

            www.mariusjopen.world

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sdg
              wrote on last edited by
              #6

              Thanks a lot, Marius.

              ‘a:after’ with !important works, but ‘a:last-child:after’ (to prevent a comma after the last menu item) does not work. When I add the !important to the last-child, it removes all commas in the menu. Without !important in the last-child, it keeps the comma after the last menu item. Do you have an idea?

              1 Reply Last reply
              1
              • mariusjopenM Offline
                mariusjopenM Offline
                mariusjopen
                Global Moderator
                wrote on last edited by
                #7

                Hey Sdg!

                with all the :last, :after, :nth-child() it can get rather complicated and confusing.
                I tried to solve it and used all different kinds of solutions. But they all seems to cancel themselves out.

                If I were in your situation I would try to solved it with a simple jQuery solution.
                With append you can insert pieces of text into div boxes – or you look for the last box in the navigation and hide the , it.

                It is a bit tricky but also a very specific detail.

                Here is a link to the LayTheme documentations to show you how to implement Javascript:
                http://laytheme.com/documentation.html#custom-javascript

                Let me know if you have more questions!

                Good luck!

                Marius

                www.mariusjopen.world

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sdg
                  wrote on last edited by
                  #8

                  Thanks for your effort! Pity that the update seems to complicate what used to be a simple trick. I’ll try jQuery, hopefully I can get it to work.

                  (Funny to run into you – Sam speaking here!)

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

                    Hey Sam!

                    Yes! How great!
                    Here we are!

                    Wow!

                    Yes, sorry about the complications. With jQuery it will be possible of course :-)

                    Much love!

                    Marius

                    www.mariusjopen.world

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      sdg
                      wrote on last edited by
                      #10

                      I tried adding this to the head:

                      <script>
                      jQuery("nav.primary li").not(":last").append(",");
                      </script>

                      and nothing happens. I tried variations but I can’t get anything to happen, so I wonder if I’m missing something obvious. I’d be very grateful for a nudge in the right direction.

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

                        Hey Sam!

                        Did you have a look into the documentation?

                        http://laytheme.com/documentation.html#custom-javascript

                        Because your Lay Theme website is a "Single Page" JavaScript application you cannot just use jQuery(document).ready(…) to execute your js because the ready event only fires once when the website loads the first time.

                        window.laytheme.on("newpage", function(layoutObj, type, obj){
                        });
                        
                        window.laytheme.on("newpageshown", function(layoutObj, type, obj){
                        });
                        

                        I hope that helped!

                        Have a good Thursday Sam!

                        Marius

                        www.mariusjopen.world

                        1 Reply Last reply
                        0
                        • mariusjopenM Offline
                          mariusjopenM Offline
                          mariusjopen
                          Global Moderator
                          wrote on last edited by mariusjopen
                          #12

                          Hey Sam!

                          I wrote you the code which you need to insert in the Custom javascript area:

                          <script>
                            window.laytheme.on("newpage", function(layoutObj, type, obj){
                          
                              jQuery('#menu-item-8a span').after(",");
                              jQuery('#menu-item-16 a span').after(",");
                          });
                          
                          </script>
                          

                          This is a bit of a dirty fix. but since you do not have many menu points it should be all right.

                          I noticed that on my testserver it needs some time until the commas appear.

                          I right now found even a better fix because it is pure CSS:

                          nav.primary a:after {
                              content: "," !important;
                          }
                          
                          .menu-item-15 a:after {
                              display: none;
                          }
                          

                          It just removes the laqst comma with a display: none.

                          Weird, that I did not have this idea from the beginning.

                          So, no jQuery needed!

                          I still leave the jQuery example above for other people to understand.

                          Great! I am happy we solved this!

                          All the best!

                          Marius

                          www.mariusjopen.world

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            sdg
                            wrote on last edited by
                            #13

                            Yes, CSS works perfectly, thanks so much! I just added color:black.

                            Much appreciated!

                            1 Reply Last reply
                            1
                            • mariusjopenM Offline
                              mariusjopenM Offline
                              mariusjopen
                              Global Moderator
                              wrote on last edited by
                              #14

                              Wonderful!

                              www.mariusjopen.world

                              1 Reply Last reply
                              0
                              • U Offline
                                U Offline
                                ute
                                wrote on last edited by
                                #15

                                Thank you so much. This helped me too!
                                just have an additional question. I want the commas to be white on my front page. I already added a piece of code, so that text is white on my frontpage, but the commas are still black.

                                body.slug-landingpage1 span{
                                color: white;
                                }

                                Would be greatful for help!

                                Thanks
                                Stella

                                http://richterstella.com/landingpage1

                                1 Reply Last reply
                                0
                                • U Offline
                                  U Offline
                                  ute
                                  wrote on last edited by
                                  #16

                                  and is it possible that the commas in the menu just stay, when i hover over them on for example this page?

                                  http://richterstella.com/about

                                  So just the commas are fixed and don't turn white on mouseover.

                                  Thanks so much!

                                  1 Reply Last reply
                                  0
                                  • mariusjopenM Offline
                                    mariusjopenM Offline
                                    mariusjopen
                                    Global Moderator
                                    wrote on last edited by
                                    #17

                                    Hi @ute
                                    You need to play with the CSS here:

                                    nav.primary a:after {
                                        content: "," !important;
                                    color: white !Important;
                                    }
                                    

                                    In your example the commas turn white though.

                                    Let me know!

                                    MArius

                                    www.mariusjopen.world

                                    1 Reply Last reply
                                    0
                                    • O Offline
                                      O Offline
                                      Organstudio
                                      wrote on last edited by
                                      #18
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • L Offline
                                        L Offline
                                        LLukas
                                        wrote on last edited by
                                        #19

                                        Hi guys, is there a solution to get commas between the menu points on mobile, too? (When "desktop menu style" is chosen)

                                        1 Reply Last reply
                                        0
                                        • P Offline
                                          P Offline
                                          paulcalver
                                          wrote on last edited by paulcalver
                                          #20

                                          Hi,

                                          I'm trying to achieve a similar menu to this but am not having any luck. aim is to get a / between each menu item, and also a space before and in front, so " / ", the space before the / works, but the one afterwards is being ignored? Also, the last-child part doesn't appear to work either, any ideas are much appreciated?

                                          Thanks, Paul.

                                          nav.primary a:after {
                                              content: " / " !important;
                                          		color: #494949 !Important;
                                          }
                                          
                                          nav.primary li:last-child:after{
                                              content: "" !important;
                                          }
                                          

                                          Screenshot 2023-02-06 at 12.24.27.png

                                          P 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