-
AuthorPosts
-
July 10, 2024 at 12:08 pm #1461772
Dear team,
I have the following requirement: I have a page where I need a different menu color on two pages.
All menu colors only with page id 26 and page wide 362 should have color #8b1a1a when the menu is not active as well as menu active. Menu hover already has the red color.
I hope, I’ve seen the page id correctly…
I’ve added the following code but it’s not working.add_action(‘wp_head’, ‘change_menu_color’);
function change_menu_color() {
if (is_page(array(26, 362))) { ?>
<style>
color: #8b1a1a !important;
</style> <?php
}
}Could you please help me? Thanks :)
Kind regards, NinaJuly 10, 2024 at 3:10 pm #1461784Hey Nihru,
You don’t have a selector in your CSS, you can try this for example:
nav.main_menu li a { color: #8b1a1a }
You could also do it with pure CSS, look for the page ID class in the body tag for each page.
Best regards,
RikardJuly 12, 2024 at 10:36 am #1461906Hello Rikard,
thanks for your answer. Unfortunately your code
nav.main_menu li a {
color: #8b1a1a
}
is not working.
Did I miss something? I am not good at programming, sorry. Would you mind giving me the code you mentioned “You could also do it with pure CSS, look for the page ID class in the body tag for each page.” ?
Thanks! :-)
Kind regards, NinaJuly 12, 2024 at 11:34 am #1461919Hi,
Please try this in Quick CSS:
.page-id-26 nav.main_menu li a, .page-id-362 nav.main_menu li a { color: #8b1a1a; }
Best regards,
RikardJuly 15, 2024 at 10:20 am #1462068Hello Rikard,
thank’s for the code. Unfortunately it’s still not working. Maybe there is a mistake with the page id from my side.
May I give you the login data so you can have a look at both page id’s?
Thanks!
Kind regards,
NinaJuly 15, 2024 at 1:58 pm #1462093Hi,
Please try this instead:
.page-id-26 nav.main_menu li a, .page-id-362 nav.main_menu li a { color: #8b1a1a !important; }
Best regards,
RikardJuly 16, 2024 at 8:28 pm #1462196Hi Rikard,
thank’s for the code. It’s still not working :-(
Any other idea?
Kind regards,
NinaJuly 17, 2024 at 12:08 pm #1462248Hi,
It’s working on my end. If you want it to apply to the transparent header state as well, then please add this:
.page-id-26 .av_header_transparency nav.main_menu li a, .page-id-362 .av_header_transparency nav.main_menu li a { color: #8b1a1a !important; }
Best regards,
RikardJuly 17, 2024 at 3:41 pm #1462278Hello Rikard,
thanks again for trying. Which browser did you use for testing?
If I add your code, it kills my white mobile menu color.
The mobile menu for mobile phones looks perfect, there is no problem.
The problem is always the desktop version there is still no change with your codes.
Do you have any other idea?
Kind regards,
NinaJuly 17, 2024 at 6:36 pm #1462301Hi,
If you don’t want it to apply to mobile devices, then please try this instead:
@media only screen and (min-width: 768px) { .page-id-26 nav.main_menu li a, .page-id-362 nav.main_menu li a, .page-id-26 .av_header_transparency nav.main_menu li a, .page-id-362 .av_header_transparency nav.main_menu li a { color: #8b1a1a !important; } }
Best regards,
RikardJuly 18, 2024 at 1:40 pm #1462389Hi Rikard,
thanks again for trying. It’s still not fully working.
The menu buttons on the “Willkommen” page appear still in white instead of the #8b1a1a – red.
On the “Fit&Schön” page it’s the same. White menu buttons instead of the #8b1a1a – red.
I’ve tested it on Opera, Google Chrome and Safari.
Positive: The mobile view has not changed this time. That part of the code worked.
Do you have any other idea?
Kind regards,
NinaJuly 18, 2024 at 5:53 pm #1462414 -
AuthorPosts
- You must be logged in to reply to this topic.