I’m creating lists in the sidebar by category and want to be able to check to see if a certain list-item is the “current” page. If the statement is true, then class=”current”
My existing li script looks like this:
<li><a href="<?php echo get_permalink() ?>" class="pageid_<?php the_id(); ?>"><?php the_title(); ?></a></li>
And although this allows me to use the pageid tag in the body id plus the page id in the link to create a custom style, it’s a ton of CSS. What I’d really like is a statement that says:
if the current page id is the same as the page id of this list-item link, then echo class=”current”
Thanks in advance for any help you can lend!
- The topic ‘A little PHP syntax help please?’ is closed to new replies.