Dear support!
I'm wondering if it is possible to insert incremental row numbers to the table generated by the View, so that line numbers be 1, 2, 3 ... Something that would work like an auto-increment field?
Thank you in advance
Dear Kirill,
Add these lines to functions.php in your theme folder:
add_shortcode('incrementor', 'incrementor');
function incrementor() {
static $i = 1;
return $i ++;
}
Then define your View template as:
<wpv-loop>
<li class="container[incrementor]"> <li>
</wpv-loop>
Please let me know if there is anything else that I can assist you with.
Regards,
Caridad
Thank you Caridad!
Never have thought I can do it this way, than you for the suggestion.
I am trying this out but its not working
<wpv-loop>
[wpv-if i="[incrementor]l" evaluate="$i == 1"]
Design Template 1
[/wpv-if]
[wpv-if i="[incrementor]l" evaluate="$i > 1"]
Design Template 2
[/wpv-if]
</wpv-loop>
How do i do this correctly? I have already included the shortcode function in my function
Hi Roville,
I try to make exactly the same thing of you.... without success for now.
Do you find a solution or maybe ideas to test with you ?
Thanks in advance,
Regards
Hi again, it's ok for me now.
Adriano give me another solution here https://toolset.com/forums/topic/isolate-the-first-result-of-a-view/
So I see that with a shorcode with attribute (we take each field with attribute) it's could be possible to make that you want Roville. It's complex but seems possible !
Regards
Thank you, Caridad! I've just found out this solution from your answer above.