I tried some codes, and I think finally works after several tries:
function ts_day_f() {
$posts= get_posts(array(
'numberposts' => -1,
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'date_query' => array(
'column' => 'post_date',
'after' => 'today',
'before' => 'tomorrow - 1 second',
)
));
if ( is_user_logged_in()) {
//return count($posts);
$c = count($posts);
return "Today: <span style=\"font-size: 1.5em;\">" .$c. "</span> posts.";
}
else {
return $null;
}
}
add_shortcode('ts_day','ts_day_f');
Additionally with the function to show only to users log in.