I php您可以根据所需的日期创建锚定类。我还没有测试过,但应该是这样的:
// your relevant html parent element
<div class="<?php echo getOlderPostsClassName( \'5/5/2012\',the_time() ); ?>">
function getOlderPostsClassName($untilDate, $wordpressPostDate)
{
$start = strtotime($untilDate);
$end = strtotime($wordpressPostDate);
if ($start-$end > 0)
{
return \'My_css_class_for_older_posts\';
}
else
{
return \'\';
}
}
然后,在Css中,您可以针对不同的子元素:
.My_css_class_for_older_posts h2{
color:red;
}