Skip Navigation

[Resuelto] Incremental row numbers in Views

This support ticket is created hace 11 años. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

Etiquetado: 

This topic contains 6 respuestas, has 5 mensajes.

Last updated by masino.sinaga hace 11 años.

Assisted by: Caridad.

Autor
Mensajes
#31041

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

#31061

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

#32256

Thank you Caridad!
Never have thought I can do it this way, than you for the suggestion.

#59895

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

#69553

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

#69666

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

#512101

Thank you, Caridad! I've just found out this solution from your answer above.

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