posts (homepage) current_page_item CSS class in menu, top level without A href
-
Hello,
please, how to have the
current_page_item
(current_page_ancestor
resp.) css class on the LI menu element corresponding to homepage (index.php) or some post (single.php)?I am NOT using custom (dynamic) menu and I do not want to do so, because I want to keep the menu actualized automatically on any page addition/removal in the “pages” admin menu (dynamic menus support only “Automatically add new top-level pages“)
Here is some demo:
https://luzanky.cz/demos/wptest1.phpBUT. There are two issues:
1) If any top menu item has a sub-menu UL (e.g. “O NáS” or “ZKU?EBNí STRáNKA“), then this top level item should not be clickable (without A tag) – it is just an empty dummy page just being there in order to have it in the menu.2) I need to get the homepage, that is default posts – news (index.php) and any particular post (single.php) being also contained in a submenu. In order to do so, I’ve created a dummy subpage (“O NáS -> aktuálně“) which is being redirected via Speedy Page Redirect plugin onto the homepage. It works, BUT this way the CSS class
current_page_ancestor
is NOT present on the top level menu item, of course ??So I need somehow:
a) achieve it (solve this issues) without having custom (dynamic) menu
or
b) let the custom menu be actualized automatically according to real sub pages (set in “pages” admin menu) somehow.Anybody could help, please?
Thanks a lot
- The topic ‘posts (homepage) current_page_item CSS class in menu, top level without A href’ is closed to new replies.