-
AuthorPosts
-
November 26, 2021 at 2:56 pm #1330603
Hi,
I want to change the order of the last 4 item of my menu (the search bar, the language switcher, the cart and the login icon) : https://i.imgur.com/SJmf5qB.png
Is there a way to change the position of the cart and the search bar ?
The order that I want is : the search bar, the cart, the login icon, and last the language switcher
I can only change the order of the login icon and the language switcher as they appear on the menu editor
Thank you for your help
Best regards,
November 26, 2021 at 3:12 pm #1330604To be more precise I made an example of how I want my menu to be displayed via photoshop : https://i.imgur.com/6b9pItx.png
And this is how my menu is displayed right now : https://vbd9xqvvjh0.c.updraftclone.com
November 28, 2021 at 1:48 am #1330711Hi,
Thank you for the link to your site and the screenshot, there is not an official way to do this but I tried to work out a script for you, I wrote it to start at 1024px because you have so many menu items that at 768px they overlap, I recommend removing some items or making the burger menu show for larger screens.
this is the expected results:
Try adding this code to the end of your functions.php file in Appearance ▸ Editor:function custom_script() { ?> <script> (function($){ var width = $(window).width(); if ( width >= 1023) { $("#header ul.cart_dropdown").detach().insertAfter('#menu-item-3092').css({'display':'block'}); $("#menu-item-search").detach().insertAfter('#menu-item-3092'); } else {} })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
and this code in the General Styling ▸ Quick CSS field
@media only screen and (min-width: 1023px) { #top .av-main-nav ul#menu-item-shop a.cart_dropdown_link { margin: 0; left: 0; color: inherit; position: relative; width: auto; -webkit-transition: color 0.15s ease-out; transition: color 0.15s ease-out; padding: 0 20px; height: 70px; line-height: 70px; border:none; } #top .header_color .main_menu ul#avia-menu ul#menu-item-shop { background-color: transparent; } #top #avia-menu #menu-item-shop { box-shadow: none; } }
After applying the css, please clear your browser cache and check.
Best regards,
MikeNovember 29, 2021 at 2:46 pm #1330841Hello Mike,
Thank you a lot for the script :)
I couldn’t add the code on my fonctions.php there was an error message : Vos modifications de code PHP ont été annulées en raison d’une erreur sur la ligne 62 du fichier wp-content/themes/enfold-child/functions.php. Veuillez la corriger et réessayer d’enregistrer.
syntax error, unexpected ‘}’, expecting end of fileBest regards,
November 29, 2021 at 2:58 pm #1330847Hi,
I couldn’t login with the password above to check, but testing the script on my test site didn’t give any errors, try copying the code again from the forum and not an email, or update the password you posted for us so we can try.Best regards,
MikeNovember 29, 2021 at 3:09 pm #1330849I just tried again but no changes. You will find my wordpress log in private
Thank you
Best regards,
- This reply was modified 2 years, 12 months ago by sofiadadci.
November 29, 2021 at 3:11 pm #1330850One minute please i try something
November 29, 2021 at 3:15 pm #1330854It’s okay now
Thanks
December 1, 2021 at 6:14 am #1331087Hi,
Thanks for the login, I found that you had an ending PHP tag in your child theme functions.php, I removed it and was able to add the script. I removed it because your main menu doesn’t look the same as when I wrote the script, if you plan to restore it as it was you can now add the script again and test.Best regards,
MikeDecember 2, 2021 at 12:32 am #1331235Hi Mike,
Thank you for your answer. My menu was not the same because at this time I was in the process to migrate my website. Now that it’s done, the official website is https://cleanaireurope.com
So I did what you have done on the clone website, on my official website : I removed the ending PHP tag then added the script, it worked. Same for the css code, no problem to save changes. The menu order is displaying like I want so I thank you for that
But there is 2 things :
1. The cart stay dark even in transparent mode https://i.imgur.com/RJFyoe7.jpeg
2. Is there a way I can change some part of your script to equalize the gaps between the menu items https://i.imgur.com/Y04EGdp.png ?
Thank you.
Best regards,
December 2, 2021 at 3:24 am #1331248Hi,
Glad this helped, I was not able to view your new site because the password seems incorrect, but the gap around the cart is set by the padding in the css above, so you could try adjusting that, on the test site the spacing seemed good, perhaps you have some other css affecting the menu items?
Best regards,
MikeDecember 2, 2021 at 3:56 pm #1331324Hi,
Oh it’s bizarre for the password. I changed the password and tested it, you should be able to connect now (info in private).
I tried to adjust the cart gap by changing the padding but it is not changing the gap but the position (the cart sit higher or lower). I tried changing other values of your css, no change.
Also do you know why the cart stay dark ? I didn’t change anything, just copied and pasted the css from my clone website
Thank you
Best regards,
December 3, 2021 at 2:41 pm #1331459Hi,
Thank you, for the cart on a transparent header I added this:@media only screen and (min-width: 767px) { #top .av_header_transparency .av-main-nav ul#menu-item-shop a.cart_dropdown_link span:before { color: #fff; } }
For the menu spacing I added this css:
@media only screen and (min-width: 767px) { .html_cart_at_menu.html_header_searchicon #menu-item-search.menu-item-search-dropdown { padding-right: 0; } }
Please clear your browser cache and check.Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.