PHP: Allowing rollover style for a button to appear on certain pages
-
I’m currently about to wrap up a site and I’ve got it where using PHP code in my anchor tags, I’m able to get the rollover style to appear for my main links. Here’s an example:
https://www.radioactivemedia.net/about/
Pretty simple. The About button has a red background and an indicator instead of a gray background.
Now clicking on any of the links in that page takes you to a child of the About main page but the About button’s background is grey again because the script doesn’t know what to do with child pages. Only the parent pages.
Here’s the script I’m using:
<?php if ( is_page('about')) { echo ' class="current_page_item"'; } ?> href="https://www.yoursite.com/parent/" title="Parent Page">Parent Page</a>
I tried changing the is_page(‘parent’) with is_page(‘parent/child’) but that doesn’t seem to work. Any way it can work or just a FOL?
- The topic ‘PHP: Allowing rollover style for a button to appear on certain pages’ is closed to new replies.