WP Check if post is new and add image Shortcode
function check_if_new( $atts ) {
$shortcode_atts = (shortcode_atts(array(
'post_id' => "1",
), $atts));
$reqid = $shortcode_atts[ 'post_id' ];
$queried_post = get_post($reqid);
$post_date = $queried_post->post_date;
$out = '';
if ( strtotime( $post_date ) < strtotime( '-15 day' ) ) {
$out = "";
} else {
$out = '<div style="display: inline; float:right;">'
.'<span><img src="imageurl"></span>'
.'</div>';
}
return $out;
}
add_shortcode( 'check_if_new', 'check_if_new' );