I tried this function. It works fine but it assumes that I will have the folders equivalent to category slugs in the root (public_html).
When I have several categories, then the root becomes extremely cluttered with so many folders for the unique content.
I would like to put all these unique content related folders under "unique-content/top/category slug" and "unique-content/bottom/category slug" corresponding to content for top and bottom of the product detail page.
How to add this extra sub-folders specs in this function so that the random file is acquired from inside this sub-folder structure?
Sorry. I don't know php, so I would really appreciate if you would help me with this change.