admin管理员组

文章数量:1122832

I am writing a Wordpress site using the block editor (Spectra One theme).

I have a menu item called News. When I click on it the News page appears and the News menu item is highlighted.

The News page has links to other news pages on it, e.g. a link to a page containing News Item 1, a link to a page containing News Item 2 etc. As soon as I click on one of these links however, the News menu item loses its highlighting.

How do I retain the highlighting of the News menu item?

Is it possible to do this via css?

(I know I can retain the highlighting of the News menu item if I add News Item 1, News Item 2 etc. to a submenu, but I don't want to do this.)

I thought the answer might lie in assigning the News page as the parent page of News Item 1, News Item 2 etc. and using current-page-ancestor but have got nowhere with this. Probably I am misunderstanding something basic. A potential solution I have found on the web involves adding code to the footer.php file but as it is a block theme it doesn't have a footer.php file.

I would be eternally grateful for any help.

本文标签: cssHow do I highlight a Wordpress Menu Item for a page that is not on the Menu