How to make multiple pages highlight a single menu item
-
I have multiple articles. Each has its own page.
When readers arrive on any of these article pages, I would like my “Articles” menu item to be highlighted.
I already know how to highlight a menu item for a single page using “li.current_page_item a” and CSS.
But if I want multiple pages to highlight that same menu item, how do I do that? I understand that I can use a conditional statement on the “li” tag, however, I cannot access the “li” tag because it is generated dynamically by the theme. (the Responsive theme).
I’m a beginner and I have no idea how to edit tags that are generated dynamically by the theme.
Since all my articles use the sidebar-content-page.php template, it would be great if I could use a conditional statement in my header.php file to detect those pages, then make all those pages highlight the Articles menu item.
So far I can detect the page template using the following code in my header.php file:
<?php if ( is_page_template(‘sidebar-content-page.php’) ) {?>
<script type=”text/javascript”>
alert(“sidebar content page detected”)
</script>
<?php } ?>Is there some code the I can replace the javascript with that will simply highlight the Articles menu item?
Thank you in advance, dear sire.
- The topic ‘How to make multiple pages highlight a single menu item’ is closed to new replies.