Skip Navigation

[Resolved] Can I output two loops in the same view?

This support ticket is created 6 years 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 6 years ago.

Assisted by: Nigel.

Author
Posts
#1140161

Tell us what you are trying to do? Output two loops of posts with different formats in the same view of user-filtered results

Is there any documentation that you are following? No.

Is there a similar example that we can see? Yes, I can provide a link privately.

What is the link to your site? I can provide a link privately.

I have a view where the user can filter results based on different input criteria. I would like to output the results as posts with a certain format, but below that entire output of results, I want to output the same results, just with a different format.

For example, for 4 results, as an output i want the following:

(Loop 1)
1: Blog Image, Blog Title, Paragraph, Link
2: Blog Image, Blog Title, Paragraph, Link
3: Blog Image, Blog Title, Paragraph, Link
4: Blog Image, Blog Title, Paragraph, Link

(Loop 2)
1: Author first name, Author last name, author email address
2: Author first name, Author last name, author email address
3: Author first name, Author last name, author email address
4: Author first name, Author last name, author email address

Is this possible with one view?

The reason (in this instance) is that I want the user to first see relevant content, and then below that a list of the authors and their email, so they can easily be copied and pasted and imported to another (email) application.

#1140336

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Katrina

A View queries the database for posts matching the View arguments, and then iterates over the matching posts to output the fields you specify.

There is no way to get the View to iterate over the results twice.

You would need two Views.

If you have a View which includes custom search filters, you can duplicate the View.

Edit the second View and change the output format as required.

In the Output Editor at the bottom, delete the wpv-filter-meta-html shortcode.

Then, where you currently have inserted the original View, insert the second View below the first one.

When you update the filter controls inserted by the first View, both Views will update according to the filter selections.

Note that this can only work when the results are updated via a page refresh, so you will want to include a submit button with the filter controls in the first View.