Skip Navigation

[Résolu] limit the number of result

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: How to set a limit and offset in a View Loop?

Solution: The loop output (amount of) is limited in the View directly, usually in the "Limit and Offset" section.

There is as well a ShortCode attribute - valid just for the View you display and it's set on the ShortCode so you can display this same View with several different settings.

In this case you would not alter the View "Limit and Offset" section." but you would add the ShortCode attribute "limit" to delimit the result.

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.

Our next available supporter will start replying to tickets in about 8.08 hours from now. Thank you for your understanding.

Marqué : ,

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

Last updated by kennethy Il y a 3 années et 1 mois.

Assigned support staff: Beda.

Auteur
Publications
#950016

View: Display the results using a custom search

Showing [wpv-items-count] posts of [wpv-found-count] posts found.
my found out is i.e. 23, I only want to display 3 items.

how can I limit the output items?

Thank you

[wpv-layout-start]
[wpv-items-found]
[wpv-view limit="3"]
Showing [wpv-items-count] posts of [wpv-found-count] posts found.
<!-- wpv-loop-start -->
<wpv-loop wrap="3" pad="false">
[wpv-item index=1]
<div class="row ">
<div class="col-sm-4">[wpv-post-body view_template="Loop item in Recommend Building"]</div>
[wpv-item index=other]
<div class="col-sm-4">[wpv-post-body view_template="Loop item in Recommend Building"]</div>
[wpv-item index=3]
<div class="col-sm-4">[wpv-post-body view_template="Loop item in Recommend Building"]</div>
</div>
[wpv-item index=pad]
<div class="col-sm-4"></div>
[wpv-item index=pad-last]
<div class="col-sm-4"></div>
</div>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/digging-into-view-outputs/?utm_source=viewsplugin&utm_campaign=views&utm_medium=edit-view-edit-layouts-helpbox&utm_term=Learn%20more%20by%20reading%20the%20Views%20Loop%20documentation.#vmeta-wpv-loop-parameters

#950114

The loop output (amount of) is limited in the View directly, usually in the "Limit and Offset" section.

Is that what you are looking for?

The ShortCode attribute as you set it is valid just for the View you display and it's set on the ShortCode so you can display this same View with several different settings.
In this case you would not alter the View ""Limit and Offset" section." but you would add the ShortCode attribute "limit" to delimit the result.

I see you tried this in [wpv-view limit="3"] but this is wrong.
The correct ShortCode is inserted with the GUI (Graphical user Interface) and not "manually", resulting in:

[wpv-view name="cp-sear-ch" limit="3"]

That will render a View with 3 results, but only the View it displays (the ShortCode)

#951038

Hi Beda,

Thank you very much for your help.
I was looking for "Limit and Offset" section also.. apparently VIEWS under "Display the results using a custom search" option have "content selection" and "ordering" ONLY..

But now i found in that "Limit and Offset" in screen option was not enabled..

everything works fine now.. 🙂

Thank you

#951086

Great, then you can mark this ticket as resolved, if there is nothing else left fort now.

Thanks and hopefully I'll be able to help you again soon!

#953474

tks