在Wordpress中突出显示活动页面菜单项

时间:2022-11-19 23:21:26

I need some help to make active the current page in my Wordpress menu in my theme. Just like on this site of mine: http://hegeduoktatas.tk

我需要一些帮助才能在我的主题中的Wordpress菜单中激活当前页面。就像在我的这个网站上:http://hegeduoktatas.tk

The code I'm trying to implement is the following (the things the code does is not interesting, I'm just trying to work, and I customize it afterwards):

我试图实现的代码如下(代码所做的事情并不重要,我只是想尝试工作,然后我自定义它):

.main-navigation .current-menu-item a{
color: #ffd696;
background: #632818;
}

.main-navigation .current_page_item a{
    text-decoration:underline;
    background:#666;
}

I tried finding the exact class/id of my menu with Firebug and inspectors, because I suspect it might be the problem, and I tried countless solutions without success. I even look after current-menu-item function on WPCodex, but still can't do it.

我试着用Firebug和检查员找到我的菜单的确切类/ ID,因为我怀疑它可能是问题,我尝试了无数的解决方案而没有成功。我甚至在WPCodex上照看current-menu-item函数,但仍然无法做到。

My site is: http://classwebdesign.hu/testing/

我的网站是:http://classwebdesign.hu/testing/

Any help is greatly appreciated!

任何帮助是极大的赞赏!

1 个解决方案

#1


0  

The link to you site is not working, but the first part of your code is right.

您网站的链接无效,但代码的第一部分是正确的。

If you find out the right class/id of your menu it should work. It would be something like this:

如果你发现你的菜单的正确的类/ ID它应该工作。它会是这样的:

.menuClass .current-menu-item a {
    /*you code here*/
}

OR

#menuId .current-menu-item a {
    /*you code here*/
}

#1


0  

The link to you site is not working, but the first part of your code is right.

您网站的链接无效,但代码的第一部分是正确的。

If you find out the right class/id of your menu it should work. It would be something like this:

如果你发现你的菜单的正确的类/ ID它应该工作。它会是这样的:

.menuClass .current-menu-item a {
    /*you code here*/
}

OR

#menuId .current-menu-item a {
    /*you code here*/
}