Random post … period

Posted in: Newspaper
Post count: 56

Random posts from the last 7 days – This field brings up random posts based on the ones published in the last 7 days.

Is it possible to change the option to monthly or current year?

T you

Post count: 35449

Hi,
Unfortunately, there is no option to change the period, sorry!

Post count: 56

Not even editing the script?

Post count: 35449

Hi,
You can edit the theme files, the problem is that you need to do this after each theme update because the code from that file can not be set in a child theme.
The file that should be edited is wp-content/plugins/td-composer/legacy/common/wp_booster/td_data_source.php and the code is around lines 519-525 – https://i.imgur.com/dOIfAbv.png is starts with case ‘random_7_day’:
Thank you!

Post count: 56

Yes ok of course

Post count: 56

Is it ok for a month?

case ‘random_7_day’:
$wp_query_args[‘orderby’] = ‘rand’;
$wp_query_args[‘date_query’] = array(
‘column’ => ‘post_date_gmt’,
‘after’ => ‘4 week ago’
);
break;

Post count: 56

Even leaving it as it was before, 7 , the news is also from 3 years ago….

Post count: 56

It seems to work!

Post count: 35449

Hi,
I’m glad you managed to create the filter as you needed. Just don’t forget that when the theme is updated, these changes will need to be applied again.

Post count: 56
Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.