[Support request] add custom class to element randomly using php

Home Forums Support [Support request] add custom class to element randomly using php

Home Forums Support add custom class to element randomly using php

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2303379
    Marco

    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.

    #2303501
    Ying
    Staff
    Customer Support

    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!

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