Wordpress author page, change menu parent -
i have author page on wordpress site (author.php). problem though when im visiting author page, wordpress highlights blog menu item. want have menu item parent. how go it? dont want use no js/jquery this.
thanks
it's not clear how author page url looks like. in general site url/author/"author name".
if site has single author can add author page link custom menu item .
or can use jquery function search "author" in url , add active class in desired menu item
<script type="text/javascript"> $(document).ready(function () { if(if(window.location.href.indexof("author") > -1)) { $("#author_menu").addclass('active'); } }); </script>
not cleanest solution, use few instances of current page menu highlighting pages aren't child/parent related in way:
<?php if (is_author()) { ?> <script type="text/javascript"> jquery(function($) { $(document).ready(function() { $('#menu-main-menu li.menu-item-"**about_us_page_class**"').addclass('current-menu-item'); }); }); </script> <?php } ?>
Comments
Post a Comment