Archived topic
Impossible to modify the active menu button via CSS when it leads to a post.
21 replies · Started by Luiz Guilherme on November 5, 2020
In GeneratePress Free, it is not possible to define a color for a menu option when this option is selected.
For some reason, when a menu item is created that points to a "Post", the "current-menu-item" class is not added.
Therefore, it is not possible to modify this button when it is active.
Note: If when creating the button, I use the "LINK" option and manually enter the post address, instead of using the "POST" option the error does not occur.
Hi there,
can you share a link to your site where i can see the issue and get a better understanding of the problem.
Site:
https://pestalozzipontobelo.com.br/
I use the follow CSS code to change color of the selected menu buttom.
/* MAIN MENU */
/* Selected Menu */
.main-nav ul li[class*="current-menu-"] > a,
/* Mobile Menu */
.menu-toggle[aria-expanded="true"]
{
background-color: #ffca08!important;
color: #515151!important;
}
But Doesn't work when a menu buttom is created by select the "POST" on screen of "Menu Edit".
The button created this way doesn't have the class "current-menu-item".
And this class is need on this part of css:
.main-nav ul li[class*="current-menu-"] > a
The problem also occour on mobile menu.
Test yourself: See that when you select the TRANSPARENCIA 2 menu it does not change color.
Test yourself:
See that when you select the TRANSPARENCIA 2 menu it does not change color.
I would like to take the opportunity to report another failure:
In wordpress, when something is not found it displays a search field, but on this site, the "Search" button has a layout problem.
See this link:
https://pestalozzipontobelo.com.br/category/lojinha/
How is the TRANSPARENCIA 2 page set up?
If i inspect TRANSPARENCIA 2 in the developer tools it is defined as a PAGE. Whereas the Menu Item link is defined as a Post. This is not normal behaviour.
Is defined "Post".
https://mega.nz/file/cIMAVBKY#4MngZltHRQPC5QLNudkfM1GtXZcWzvjZMHoGlE4VS2A
Do you have a Page with the same title as the Post ?
See here - the link takes you to this which is a Page:

01 - Perfect, that was it. I had created a page first, so I changed my mind and decided to use a Post, but do not delete the page.
With the exclusion of the page everything is working fine.
02 - What about the Search button that is not displayed correctly?
Can you try changing the Customizer > General --> Icon Type to SVG
It worked.
I defined the font, because in the future I intend to create a package of personalized fonts, following instructions that I had here
https://generatepress.com/forums/topic/how-to-display-other-icons-fonts-besides-the-magnifying-glass/#post-1438058
I have other old sites that I use the "font" option and the text "Search" is displayed instead of the "magnifying glass" icon.
Does the "Font" option no longer work?
It should work - try switching back to Icon > Font and clear any caches.
I tried this, the error persists whenever I re-active the "Fonts" option.
Even on the smartphone, regardless of the browser used, the error occurs.
I have also tried to disable all plugins and the error occurs.
I use a child theme on this site, so I tried to activate only the parent theme, and the error persists.
I am using Wordpress version 5.5.3 – pt_BR.
Weird. Maybe leave it as Icon. You can use Filter to switch them - heres an example of that:
https://generatepress.com/forums/topic/svg-menu-icon-bars-fatter/#post-1520827
Happy to help if you need assistance switching any of them over to your own SVGS.