Hi i want to create zebra table in search results:
this is a html:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<table width="100%">
<thead>
<tr>
<th>[wpv-heading name="post-link"]כותרת[/wpv-heading]</th>
<th>[wpv-heading name="types-field-num_hozer"]מספר החוזר[/wpv-heading]</th>
<th>[wpv-heading name="types-field-select-a48cc259"]שנה[/wpv-heading]</th>
</tr>
</thead>
<tbody class="wpv-loop js-wpv-loop">
<wpv-loop>
[wpv-item index=1]<tr class="ODD">
[wpv-post-body view_template="Loop item in חיפוש חוזרים מקצועיים"]
</tr>
[wpv-item index=other]
<tr class="EVEN">
[wpv-post-body view_template="Loop item in חיפוש חוזרים מקצועיים"]
</tr>
</wpv-loop>
</tbody>
</table>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
where i do something wrong?
Tnx
Noman
Supporter
Languages:
English (English )
Timezone:
Asia/Karachi (GMT+05:00)
1. Please use this code in your View, it will give you result like in attached screenshot:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<table width="100%">
<thead>
<tr>
<th>[wpv-heading name="post-link"]כותרת[/wpv-heading]</th>
<th>[wpv-heading name="types-field-num_hozer"]מספר החוזר[/wpv-heading]</th>
<th>[wpv-heading name="types-field-select-a48cc259"]שנה[/wpv-heading]</th>
</tr>
</thead>
<tbody class="wpv-loop js-wpv-loop tbl-zebra">
<wpv-loop>
<tr>[wpv-post-body view_template="Loop item in חיפוש חוזרים מקצועיים"]</tr>
</wpv-loop>
</tbody>
</table>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
2. And add following css in View’s >> CSS editor section:
tbl-zebra tr:nth-child(odd) {
background-color: #ccc;
}
I hope it helps, Thank you