if anyone could help it would be greatly appreciated, been trying to get this done on and off for a long time and just can't get there.
I am using the function below in a loop to count posts within a taxonomy name. Function below works fine, but would it be possible to refine the function further to only count posts that were published within the last 24 hours? I found a similar questions but couldn't get it to work with get_term_by Count posts or custom post types from last 24 hours (or from today)
Any help greatly appreciated.
<?php
global $post;
$taxonomy = "news";
$term_name = $post->post_title;
$term = get_term_by('name', $term_name, $taxonomy);
echo $term->count ;
?>