Different color for different date
-
Hi –
I’ve been trying to figure this out all day. I’m not a coder so it might be a lot easier than I’m presenting it. Here goes.
I have this code listing titles of pages with a certain parent.
<?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
What I really want to be able to do is evaluate the date the page was created and make the link red if it’s from this year. So far, all I’ve been able to do is add the year after the page title so someone can see when it was created. To draw attention to it, I wanted to make it red.
I’ve tried to set $thisyear to date(‘Y’) and if it matches the_time(‘Y’), then use a certain style, but all it does is print a year (2008 in this case) at the very top of the list. Even when I’m not asking it to do that!
I feel like I’m missing a while loop for it to know to keep going until the end of the pages, but am not sure where that would be placed, even.
Has anyone any ideas to get me going in the right direction?
Thanks,
Beth
- The topic ‘Different color for different date’ is closed to new replies.