Skip Navigation

[Resolved] Create a dynamic class attribute

This support ticket is created 7 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 7 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#420618

Hi Guys,

quick question,

I have to following loop

...
 <div id="container">  
    <wpv-loop>
     	<div class="flex-item">[wpv-post-body view_template="Home page categories"]</div>
    </wpv-loop>
</div>
...

Is there a way of creating a dynamic class for the class=flex-item for every time it ran through the loop. Ie I would like to see a result of the following for every flexbox in the series:

class="flex-item item1"
class="flex-item item2"
class="flex-item item3"
ETC

for each of the resulting boxes in the series for the loop. The reason for this would be to to identify a specific box for css editing

Thx

#420660

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Have you looked at [wpv-item] shortcode?

For example:

...
 <div id="container">  
    <wpv-loop>
[wpv-item index=1]
        <div class="flex-item item1">[wpv-post-body view_template="Home page categories"]</div>
[wpv-item index=2]
<div class="flex-item item1">[wpv-post-body view_template="Home page categories"]</div>
[wpv-item index=3]
<div class="flex-item item1">[wpv-post-body view_template="Home page categories"]</div>
    </wpv-loop>
</div>
...

More info:
https://toolset.com/documentation/views-shortcodes/#wpv-item

Does this helps/

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.