Hi, thanks for answering! Unfortunately it didn't work, maybe there was something else wrong with the code snippet. I got another one that let me inline css with a shortcode. Here's the workaround in case anyone needs such a thing :
function get_latest_project() {
$current_post_id = get_the_ID();
$args = array(
'post_type' => 'projects',
'posts_per_page' => 1,
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',
);
$query = new WP_Query( $args );
$latest_post_id = null;
if ( $query->have_posts() ) {
$query->the_post();
$latest_post_id = get_the_ID();
wp_reset_postdata();
}
$css = '<style>/* not latest */</style>';
if ($latest_post_id AND $current_post_id == $latest_post_id) {
$css = '<style>/* latest */</style>';
}
return $css;
}
add_shortcode( 'latest_project', 'get_latest_project' );