Home Forums Front-end Issues different css for select entrys


different css for select entrys

  • hi
    i not understand how can i do this.

    i have create select field with 3 differnet entrys. i want display this entrys with different css code, like this:

    entry1 <div class”entry1″>
    entry2 <div class”entry2″>
    entry2 <div class”entry2″>

    can everyone help me

  • Hi @seraph1976,

    Thanks for the post.

    To achieve this, you would need to create a conditional block to check for the value selected and then call a certain class within that selection.

    For a single-value select field, the code would look like so:

    if(get_field('select_field_name') == "value_1")
        //call the class here
    }elseif(get_field('select_field_name') =="value_2")
      //some other class here
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.