<?php
$categories1=get_categories('orderby=post_date&order=DESC');
function filter_where( $where = '' ) {
$today = date('Y-m-d', current_time( 'timestamp' ));
$yesterday = strtotime ( '-1 day' , strtotime ( $today ) ) ;
$yesterday = date('Y-m-d', $yesterday);
$where .= " AND post_date >= '" . $yesterday . "'" . " AND post_date < '" . $today . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
foreach($categories1 as $category1) {
$posts=get_posts('showposts=1&cat='. $category1->term_id);
if ($posts) {
foreach($posts as $post) {
setup_postdata($post);
?>
<li>
<?php the_time('F j, Y , g:i a') ?>
<h6></h6>
<h5 class="l_yellow"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h5>
</li>
<?php }}}
remove_filter('posts_where', 'filter_where');
wp_reset_query();
?>
my question :
Today date july 14 , why show up post from date july 11 ? I want get only date not time.
I have one post in two categories , how to show up only one post from one categories ?
