Post Block Customization Request

Posted in: Newspaper
Post count: 18

Going straight to the point.
I (we) need additional “Sort order:” for option available from Block >> Filter >> Sort order.
The additional sort order needed is “Random posts from last 24 hours” option so that we can display some random posts created in the last 24 hours for our readers.

The Random posts Today option will not work if the time is between 00:00 hours to 06:00 hours when no posts have been created yet, so the “Random posts from last 24 hours” make much sense.

I have edited td-composer plugin to achieve the needed result, but is there a way to get a custom code I can use so that the next update will not overwrite my customization and break the site.

Note 1: the customization was affected by lscache plugin, so it doesn’t randomize on page reload until the next cache purge, which is understandable

Below are the files edited in the plugin.

File: td_data_source.php
Location: /plugins/td-composer/legacy/common/wp_booster/td_data_source.php:
Lines Edited: 238 – 244

case 'random_last_24':
$wp_query_args['orderby'] = 'rand';
$wp_query_args['date_query'] = array(
'column' => 'post_date_gmt',
'after' => '24 hours ago'
);
break;

File: td_config.php
Location: /plugins/td-composer/legacy/Newspaper/includes/td_config.php:
Line Edited: 39184 (added)

'Random posts from last 24 hours' => 'random_last_24',

  • This topic was modified 4 years by goodmuyis. Reason: Formatting
Post count: 21065

Hello!

My colleague replied you via email, so please check and continue the discussion there.

Thank you for understanding!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.