Custom filter to get random post from last 2 months

Posted in: Newspaper
Post count: 13

Hi!

I would actually like to have this functionality:
Random posts from last 2 months

Please let me know how to make this new filter so we can show random posts from the last 2 months, and possibly even have a second option to have only from the last 30 days aswell.

Thanks

Post count: 35449

Hi,

Unfortunately the theme do not have an option to create or edit a filter, therefore these changes need to be made in theme files.
The only solution, in this case, would be to edit the popular7, just replace in the code the “604800” seconds for seven days with the “2592000” for 30 days.
The file that need to be edited is on this path -> wp-content/plugins/td-composer/legacy/common/wp_booster/td_data_source.php -> https://i.imgur.com/VXFW5ec.png
In order to change the text from drop-down chooser you need to edit the wp-content/plugins/td-composer/legacy/Newspaper/includes/td_config.php
-> https://i.imgur.com/rYb8fOW.png

Hope this will help you!

Post count: 13

Hi Calin,

Thanks for your reply!

How can I edit these two files AND be sure that they are not overwritten by any future updates on the theme? Is it possible to do it the same way as with child-themes?

Post count: 13

Also, you tell me to edit the “popular7” function instead of the random post function – how come? Wouldn’t it just be to edit the function for “Random posts from last 7 day”? in the same files? (As mentioned already I want random posts rather then popular posts)

Post count: 35449

Hi, sorry was my mistake, I do not know why I was thinking to popular 7 days when you clearly say random post from last 2 mounts, sorry!
The changes need to be made in the same file paths but on other lines code -> wp-content/plugins/td-composer/legacy/Newspaper/includes/td_config.php -> https://i.imgur.com/GZDtI4N.png -> https://i.imgur.com/VGijQWW.png and in wp-content/plugins/td-composer/legacy/common/wp_booster/td_data_source.php -> https://i.imgur.com/fUfMtK2.png
Unfortunately for the moment those settings need to be made after theme update because this file d_data_source.php do not work from child theme, sorry for the inconvenience!

Hope this will help you!
Let me know the results!

Post count: 13

Thank you 🙂

One last question:

How can we add a filter on the Infinite Loading for Single Posts so that it does not show posts older than 2 months (or any other period we decide on).

As you can see its not an option within TD Composer now:

Post count: 13

Post count: 35449

Hi,

For the moment the auto loading option from single post template do not has this options, sorry!
Also for the moment the only filters are for category, therefore in order to achieve what you need will be need a new filter and this can be achieve only with custom work.
If you want that implementation, you can make a request to our custom services from here -> https://tagdiv.com/web-development-services/

Thank you for your understanding!

Post count: 64

Hi,
we also need option to show random post for 30 days or more, but…
we make changes of this two .php files as you wrote, but it no working.

I also notice that structure of td_config.php and td_data_source.php is different then on screenshots you share.

Thank you for hepl in advance.

BR,
Tech Lifestyle ADMIN

Viewing 9 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic.