Archived topic
add custom class to element randomly using php
1 reply · Started by Marco on August 4, 2022
Hello
let's say I have a array with e.g. 3 css class names - I also have a loop of e.g. 50 items and I'd like to randomly assign one of the three classes to an element - however, most of the items should not get any class at all - is there a way to do this?
to make it more clear - I'd like to set up a tiled gallery in Wordpress using css grid - every few picture I'd like to either add a class: big, wide, or tall - a gallery can have any number of pictures.
hope somebody has an idea how to do this.
thank you in advance for your input.
Hi Marco,
As it's not a theme-related question, it's better to post it at a website like this: https://stackoverflow.com/
Please refer to the link below for what's included in the GP premium support forum:
https://generatepress.com/what-support-includes/
Thanks for your understanding!