I am trying to:
I'm trying to show single "speech of a congress" related to a "congress" post, grouped by date field.
Many "speech" are related to many "congress".
I have created one view for show the date (in bold) and below this, a second view for show the "speech" related to a "congress".
I expected to see:
For one "congress":
29 November 2019
-- Speech 1 (at 1pm)
30 November 2019
-- Speech 2 (at 2pm)
-- Speech 3 (at 3pm)
Instead, I got:
For one "congress":
29 November 2019
-- Speech 1 (at 1pm)
30 November 2019
-- Speech 2 (at 2pm)
-- Speech 3 (at 3pm)
30 November 2019 <<<< duplicate
-- Speech 2 (at 2pm) <<<< duplicate
-- Speech 3 (at 3pm) <<<< duplicate
Then you can use the Post Selection tab in the Fields and Views popup to display information from a related post in the loop. Once I see how your Views are set up I can make a more definite suggestion.
I attach three images:
- About loop editor of the first view (title with date and wpv-view shortcode of the second view with the shortcode parameter to passing to second view);
- About loop editor of the second view (in this view, I took the parameter passing by shortcode before);
- About che body of the second view, with the data of the "speech".
In the first View, remove the h5 tag and the date. Move the date into the second View. You can do that by passing the formatted date into a second shortcode attribute like "formatted_date". Then in the second View, use wpv-item blocks to display the date only for the first row:
Sorry, I must not understand how the Views are set up. May I log in to your wp-admin area and take a look? I think it help me understand the repetition and provide the correct answer. Please provide login credentials here and let me know where I can see the View on the front-end of your site (provide a URL).
Okay I see. The problem here is that you have nested two Views that loop over the same posts, so the duplication is expected. I assumed the outer View looped over some other post type, which is not the case here. The only way this nested setup would work is if the outer loop looped over Dates, not Interventi. Dates would have to be a custom post type in some post relationship with Interventi. There is not really an easy way to "group" posts of one post type based on a custom field value, because Views is designed to loop over posts, not fields. Grouping by date here will require custom programming that I'm not able to provide here in the support forums.