Tell us what you are trying to do?
I'm trying to feed the value of the "wpv-found-count" of a view to a custom field via shortcodes.
for that the custom field was made to be 'single line' type so that it could be populated with a shortcode.
it appears that wpv-found-count can successfully populate the field with an expected text. (e.g. a number or No items found)
However i cannot meaningfully use the value of the custom field in dynamic string comparisons to conditionally display an elementor element.
for example, if value of custom field is "No items found" conditionally hide element, otherwise display the View
Please let me know if there are ways to reconcile the difference?
Is there any documentation that you are following?
I have a Post Field Group with a number of fields.
I wanted a content template to conditionally display some of the fields. e.g if i do not have any posts that fits some criteria, hide the element which contains the view in the template.
my initial thoughts are to add a new field which counts posts which fits the criteria. the value of this field will be shortcode [wpv-view name=XXX], where xxx is a view which included [wpv-found-count] before the loop. and it does help, although the view probably returned something more than just the value of [wpv-found-count], which was why initially I could not meaningfully set up a condition.
So in the above problem, i managed to work around with the concept 'if field contains text which equals "No items found" ( which illustrates i have no post that fits the criteria), hide the element which contains the view so it does not show up front end'.
for now it looks workable, but i think if there should be a sizable number of posts, will the loop affect the performance of the page?
Is there a way to pass just the value of [wpv-found-count] without looping? or that the loop is essential for [wpv-found-count] to arrive at a value?
In other words, can [wpv-found-count] be used without a view?
for now it looks workable, but i think if there should be a sizable number of posts, will the loop affect the performance of the page?
It will affect the page performance. I was thinking of a way to limit this but given that you're using the found count then the limit settings on the view will affect the number that is being displayed. Given that the view is just going to list out the found count and not any post data then I dont expect the page performance to decline in any significant way.
Is there a way to pass just the value of [wpv-found-count] without looping? or that the loop is essential for [wpv-found-count] to arrive at a value?
No there isn't the [wpv-found-count] needs to be within the view items found section in order to work. This shortcode cannot function outside of a view.