Skip Navigation

[Résolu] Limit number in Views php template

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

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
- 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)

Marqué : 

This topic contains 4 réponses, has 2 voix.

Last updated by hugoC-3 Il y a 3 années et 10 mois.

Assisted by: Shane.

Auteur
Publications
#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
Supporter

Languages: Anglais (English )

Timezone: 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
Supporter

Languages: Anglais (English )

Timezone: 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!

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