Skip Navigation

[Resolved] Limit number in Views php template

This support ticket is created 4 years, 6 months ago. 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)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by hugoC-3 4 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#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: English (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: English (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!