admin管理员组

文章数量:1124685

I have selected the following settings in WordPress:

And created a navigation with two links:

The Work link should link to my homepage which is why I set the URl to /. This works perfectly fine. Though the current-menu-item-class is not added to the element when being on the homepage:

Is there a correct way of fixing this?

Looking forward to your reply!

I have selected the following settings in WordPress:

And created a navigation with two links:

The Work link should link to my homepage which is why I set the URl to /. This works perfectly fine. Though the current-menu-item-class is not added to the element when being on the homepage:

Is there a correct way of fixing this?

Looking forward to your reply!

Share Improve this question edited Mar 4, 2024 at 17:17 Marzii asked Mar 4, 2024 at 17:17 MarziiMarzii 336 bronze badges 3
  • it's probably because it's a custom link, there is a home link block that can be used for the homepage instead – Tom J Nowell Commented Mar 4, 2024 at 17:53
  • Hi Tom, I see. Using the home link block works. There is no easy option to rename it or am I mistaking? The only option is to change the label with js? – Marzii Commented Mar 4, 2024 at 18:17
  • I was able to change the label of the home link by clicking on it and typing just like headings and paragraph text, I was even able to apply rich text formatting – Tom J Nowell Commented Mar 4, 2024 at 19:22
Add a comment  | 

1 Answer 1

Reset to default 0

That's because the current menu classes aren't applied based on the URL but instead based on the main query.

For the homepage, instead use a homepage link block:

You can edit it just link any other nav menu item or paragraph by clicking and typing on it directly:

本文标签: theme developmentHomepage with latest posts does not include currentmenuitem