Skip Navigation

[Resolved] Can I pass the Post # “limit” as a shortcode argument?

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to pass an override "limit" into a View using a shortcode attribute.

Solution: Use the "limit" shortcode attribute to pass in an override value for the limit criteria. When inserting a View shortcode, use the Override Settings tab in the popup to specify override criteria.

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-view

This support ticket is created 6 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by ethanB 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#914349
limit.jpg

[wpv-view name="my_view" limit="4"]

I'd like to limit the number of posts displayed from a view loop as an argument in the shortcode rather than in the setting for the entire view itself.

Is this possible?

Thanks,
Ethan

#914493
Screen Shot 2018-06-17 at 5.44.00 PM.png

Hi, yes it's possible just like you guessed:

[wpv-view name="your-view-slug" limit="2"]

When you use the Fields and Views button to insert a View, there is a tab in the popup called "Override settings". You can set the limit and other pagination overrides here, or add the limit attribute directly to the shortcode.

#914504

Thank you!!