I have 3 different custom post types, with each type forming my main navigation. When I post something new under one of them, I want that category in the nav to be marked with a "new" label for a limited time (7 days for example).
I've found a few decent posts on how to apply it to single posts, but I can't figure out how to apply it to multiple categories in the top navigation.
The code for single posts is below should that be of any use:
function newly_posted() {
global $post;
$now = date('U'); $published = get_the_time('U');
$new = false;
if ( $now-$published <= 3*24*60*60 ) $new = true;
return $new;
}
Any help would be appreciated!
EDIT: As mentioned in the comments, I'm I'm basically looking for something that will do: If post type X has new post within 7 days, add class "new"
option
upon post submit. This way you can have what you need in a matter of one function call. – Hamed Momeni Apr 7 '13 at 18:22<li id="nav-design"><a href="<?php echo get_settings('home'); ?>/design">
</a></li>` In pseudo code, I'm basically looking for something that will do:If post type X has new post within 7 days, add class "new"
– Tom Apr 8 '13 at 17:21