Skip Navigation

[Résolu] Odd/Even styling using classic views

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
Odd/Even styling using classic views

Solution:
Toolset view's shortcode [wpv-item] offers the attribute index and with index attribute you can define the odd or even.

You can find proposed solution, in this case with the following reply:
https://toolset.com/forums/topic/odd-even-styling/#post-2227725

Relevant Documentation:
=> https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-154400

This support ticket is created Il y a 2 années et 11 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 7 réponses, a 2 voix.

Dernière mise à jour par marioD-5 Il y a 2 années et 11 mois.

Assisté par: Minesh.

Auteur
Publications
#2227241
oddeven.png

Hello,

I have a view (loop pasted below this message), that has 3 columns and I'd like to apply an odd/even class styling.
I added the desired effect in the attached screenshot.

-----------------
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="container wpv-loop js-wpv-loop speakers_container">
<wpv-loop wrap="3" pad="true">
[wpv-item index=1]
<div class="row ">
<div class="col-md-4 speaker_odd">[wpv-post-body view_template="loop-item-in-view-speakers-in-an-event"]</div>
[wpv-item index=2]
<div class="col-md-4">[wpv-post-body view_template="loop-item-in-view-speakers-in-an-event"]</div>
[wpv-item index=3]
<div class="col-md-4">[wpv-post-body view_template="loop-item-in-view-speakers-in-an-event"]</div>
</div>
[wpv-item index=pad]
<div class="col-md-4"></div>
[wpv-item index=pad-last]
<div class="col-md-4"></div>
</div>
</wpv-loop>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No speakers found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
----------------------

#2227725

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Toolset view's shortcode [wpv-item] offers the attribute index and with index attribute you can define the odd or even.

For example:

<wpv-loop>
    [wpv-item index=odd]
         add your content for odd index
    [wpv-item index=even]
         add your content for even index
       
 </wpv-loop>

More info:
=> https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-154400

#2227761

Hi Minesh,

I got that part, but how can I still put them into a 3 columns layout?
Please check my code to see what I mean.

Thanks,

#2227803

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

As you want to use the pad and wrap attribute with your loop.

You can add styling that you want to add for odd to the following:
- [wpv-item index=1]
- [wpv-item index=3]

And you can add the even styling to the following:
- [wpv-item index=2]

#2227861

Hi Minesh,

Please check the screenshot I attached in my initial question.
Your solution repeats the same pattern on each line:
1 = purple
2= red
3=purple

That's not exactly what I'm looking for.

Is there any other way you could think of?

Thanks for your assistance,

#2227865

Nevermind, I figured it out.
I changed wrap=6 and explicitly declared index 1 through 6.

My issue is resolved now. Thanks,

#2227873

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Great - you are welcome to mark resolve this ticket.

#2227875

My issue is resolved now. Thank you!