lscura
Forum Replies Created
-
Thank you!
This looks promising! I will definitely try it.Thanks for answering!
That is weird. I tested with some articles within the last 30 days and even though I published some articles they were not showing up until I visited them. And then on the frontend, there was showing up only the articles with more visits. That is why I thought it worked!- This reply was modified 3 years, 7 months ago by lscura.
This code seems to finally work:
$args = array( 'post__in' => $topposts, 'orderby' => 'post_date', 'numberposts' => $limit, 'posts_per_page' => $limit, 'ignore_sticky_posts' => $ignore_sticky, 'date_query' => array( array( 'after' => '30 days ago', 'inclusive' => 'true' ), ) );
- This reply was modified 3 years, 7 months ago by lscura.
Update:
I’ve added “date parameters” of WP_Query to only show posts from the past month. Will it work?
$args = array(
‘post__in’ => $topposts,
‘orderby’ => ‘post_date’,
‘numberposts’ => $limit,
‘posts_per_page’ => $limit,
‘ignore_sticky_posts’ => $ignore_sticky,
‘date_query’ => array(
array(
‘year’ => date( ‘Y’ ),
‘month’ => date( ‘M’ ),
),
),
);- This reply was modified 3 years, 7 months ago by lscura.