Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialFred Gomes
7,857 PointsWordpress Nav Active 'selected'
Hi everyone! Pretty new with wordpress and I'm having some issues with a nav bar. Inside the index.page I have a sublink that goes to a new page called News but I stil want HOME to appear active although it stays innactive. Here's the code:
Nav (header.php) <li><a href="<?php bloginfo('url'); ?>/home" class="<?php if(is_page('Home')) {echo 'selected';} ?>">Home</a></li> <li>·</li> <li><a href="<?php bloginfo('url'); ?>/biography" class="<?php if(is_page('Biography')) {echo 'selected';} ?>">Biography</a></li> <li>·</li> <li><a href="<?php bloginfo('url'); ?>/gallery" class="<?php if(is_page('Gallery')) {echo 'selected';} ?>">Gallery</a></li>
Link (index.php) <a href="<?php bloginfo('url'); ?>/home/news" class="<?php if(is_page('Next')) {echo 'selected'} ?>" id="next">Next</a>
I tried to find a way to change 'selected' to 'home' but I haven't managed to find a way. Could someone help me with this problem?
Much appreciated!
2 Answers
Zac Gordon
Treehouse Guest TeacherHey! Try checking out this post
Fred Gomes
7,857 PointsThank you very much for your time and help.