• I have created a website which keeps track fo which page the user is on and highlights the correct links accordingly. I have now come to the dynamic part of the site and when the links go to the posts section I can no longer keep track of where I am. How do I do this?

    Using an example:

    I have a members page, which when clicked on the link is highlighted to show it is current. I have this set up so that this ‘members’ parent remains highlighted for all child links. However, in the members section the content is mostly dynamic and so not suitable to use pages. As such I am using posts, and I can display the posts on the members page. The problem comes when clicking the link to read a specific post in detail. WP then loads the category page and all link tracking stops.

    Is there a specific way I need to set the site up to enable the tracking to remain functional throughout? Or is there a clever plugin that will assist with this? r will I have to do some coding myself? I’d really appreciate some input and advice from those who have attempted similar setups.

    Edit: I have looked at using the in_category() function but because my main menus are dynamically created I don’t see how I can implement this.

Viewing 1 replies (of 1 total)
  • Thread Starter churchill614

    (@churchill614)

    It won’t let me edit again so I’ll post a reply instead.

    I have come up with a solution, although in my opinion it is more of a hack than anything else because if I change the menu I will have to change the template code. What I have done is add the following code into the template page:

    <?php if ( in_category( '6' ) ) : ?>
    	<style>
    		#header-nav li.page-item-144 {
    			border-bottom: 5px solid #4cbf0e;
    			height: 38px;
    			cursor: pointer;
    		}
    
    		footer li.page-item-144 a {
    			font-weight: bolder;
    		}
    	</style>
    <?php endif; ?>

    Is there a more elegant solution that this? Or is this an accepted method?

Viewing 1 replies (of 1 total)
  • The topic ‘Dynamic Menu Highlighting between Pages and Posts’ is closed to new replies.