Lay Theme Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    Separate menu items by commas instead of spacing?

    Feedback
    menu
    7
    21
    2133
    Loading More Posts
    • 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
      sdg last edited by

      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 Reply Quote 0
      • arminunruh
        arminunruh Global Moderator last edited by

        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 Reply Quote 0
        • S
          sdg last edited by sdg

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

          1 Reply Last reply Reply Quote 0
          • S
            sdg last edited by

            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 Reply Quote 0
            • mariusjopen
              mariusjopen Global Moderator last edited by

              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 Reply Quote 0
              • S
                sdg last edited by

                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 Reply Quote 1
                • mariusjopen
                  mariusjopen Global Moderator last edited by

                  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 Reply Quote 0
                  • S
                    sdg last edited by

                    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 Reply Quote 0
                    • mariusjopen
                      mariusjopen Global Moderator last edited by

                      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 Reply Quote 0
                      • S
                        sdg last edited by

                        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 Reply Quote 0
                        • mariusjopen
                          mariusjopen Global Moderator last edited by

                          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 Reply Quote 0
                          • mariusjopen
                            mariusjopen Global Moderator last edited by mariusjopen

                            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 Reply Quote 0
                            • S
                              sdg last edited by

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

                              Much appreciated!

                              1 Reply Last reply Reply Quote 1
                              • mariusjopen
                                mariusjopen Global Moderator last edited by

                                Wonderful!

                                www.mariusjopen.world

                                1 Reply Last reply Reply Quote 0
                                • U
                                  ute last edited by

                                  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 Reply Quote 0
                                  • U
                                    ute last edited by

                                    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 Reply Quote 0
                                    • mariusjopen
                                      mariusjopen Global Moderator last edited by

                                      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 Reply Quote 0
                                      • O
                                        Organstudio last edited by

                                        This post is deleted!
                                        1 Reply Last reply Reply Quote 0
                                        • L
                                          LLukas last edited by

                                          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 Reply Quote 0
                                          • P
                                            paulcalver last edited by paulcalver

                                            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 Reply Quote 0
                                            • First post
                                              Last post

                                            I don't answer or check forum DMs, please just post on the forum.

                                            Try this to fix issues before you post:

                                            Use the Search Feature. Maybe there is already a solution to your issue.

                                            1. Update Lay Theme and all Lay Theme Addons
                                            2. Disable all Plugins
                                            3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
                                            4. Now see if your problem solved itself
                                            5. Go here, see if your problem is listed here:
                                            Troubleshooting

                                            When you post:
                                            1. Post a link to where the problem is
                                            2. If the problem is difficult to explain, post screenshots / link to a video to explain it

                                            Thanks!

                                            Online Users

                                            I

                                            Recent Topics

                                            • M

                                              Tag filter / Maximum width

                                            • open all links in a thumbnail grid in a new tab

                                            • text underline

                                            • centred Carousel fixed width and proportions

                                            laytheme.com