Home › Forums › Pro Support › Show newest/latest products each week › Reply To: Show newest/latest products each week
May 27, 2019 at 4:56 pm
#9551
Keymaster
Hi there,
This is the filter you need: https://github.com/tomusborne/wp-show-posts/blob/release/1.2/wp-show-posts.php#L383
It’s only in 1.2 at the moment, which you can download from GitHub.
Then your function would be:
add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) {
if ( 123 === $settings['list_id'] ) {
$week = date( 'W' );
$year = date( 'Y' );
$args['w'] = $week;
$args['year'] = $year;
}
return $args;
}, 10, 2 );
You just need to update 123
with the ID of your list.