Using global $post; with custom post types
How about this? (Add to your theme’s functions.php file, or to a plugin.) function new_post_alert() { global $post; $ageunix = get_the_time( ‘U’ ); $days_old_in_seconds = time() – $ageunix; $days_old = $days_old_in_seconds / 86400; $post_type = get_post_type(); if ( ( $days_old < 3 ) && ( ‘news’ === $post_type ) ) { ?> <script type=”text/javascript”> jQuery(document).ready(function($){ … Read more