Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Show newest/latest products each week Reply To: Show newest/latest products each week

#9551
Tom
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.