Z
Z
ZaurK2021-11-09 11:13:19
WordPress
ZaurK, 2021-11-09 11:13:19

How to display the last added files in a list on the site?

Good day! Tell me how you can display the last added files on the main page?
I didn’t find the widget and googling didn’t work, everywhere it’s written about how to display the latest posts, but so that it’s the files ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeniy, 2021-11-09
@Evdokim001

Pay attention to this hook . With it, you can connect to adding a file. It is possible at this moment to write the data to a separate file, and then read the data on the desired page so as not to run the cycle of checking the uploads folder once again. Or, the second option, you can run a cron that will read the data in the uploads folder and write it to the file.txt file every 12 hours.

A
Artem Zolin, 2021-11-09
@artzolin

scandir()- gets an array of files and directories located at the specified path
filectime()- returns the time the file was last modified

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question