0

Please help me

I want to make a list based on the name of the day ordered based on the selected category

I have code like this but it doesn't work orderby day

<?php


$args = array( 'posts_per_page' => 100, 'offset'=> 0, 
'category' => 338,'order'=> 'asc', 'orderby' => 'day');



$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>

<tr>
<td><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></td>
<td><?php the_time('l'); ?></td>
<td><?php the_time('H:i'); ?> Wib</td>
</tr>
<?php endforeach; 
wp_reset_postdata();?>

1 week is equal to 7 days how to make wordpres code sorted by day. ?

0

There is a better method using date_query property of WP_Query class:

'date_query'    => array(
        'column'  => 'post_date',
        'after'   => '- 1 days'
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.