Saltar navegación

[Resuelto] Limit number in Views php template

This support ticket is created hace 4 años, 11 meses. 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Etiquetado: 

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por hugoC-3 hace 4 años, 11 meses.

Asistido por: Shane.

Autor
Mensajes
#1658345

Tell us what you are trying to do?
I succesfully included a view in a Buddypress template, except that I am not able to limit the number of items shown. In my content template I added [wpv-post-body view_template="loop-item-in-myview" limit="3"] but this does not work.

Is there any documentation that you are following?
https://toolset.com/forums/topic/using-view-shortcode-as-php/

#1658655

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Hugo,

Thank you for getting in touch.

You are using the shortcode [wpv-post-body view_template="loop-item-in-myview" limit="3"] which is meant to display a post's content.

This means that it wont accept a limit attribute. The limit attribute is meant to be used on the view shortcode directly, here is an example below.

 [wpv-view name="myview" limit="3"]

Please let me know if this clears things up for you.

Thanks,
Shane

#1658683

OK, I see.
Can I also apply this limit in a php template like
echo render_view( array( 'name' => 'myview' ) );
?

#1658687

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Hugo,

Yes you can.

Just add it like this.


echo render_view( array( 'name' => 'myview' , 'limit'=>'3' ) );

Please let me know if this helps.
Thanks,
Shane

#1658689

My issue is resolved now. Thank you!