Skip Navigation

[Resuelto] order in view of parents about date out of repeatable fields view

This support ticket is created hace 3 años, 9 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 7 respuestas, tiene 2 mensajes.

Última actualización por alexd-6 hace 3 años, 8 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#1970443

Hi,

im trying to order in view of parents about date (month) out of repeatable fields view.

I have an CPT "Veranstaltungen" with an repeatable Fields "Veranstaltung_date" - it include an datefield.

The "Veranstaltung_date" is included as seperate View which is filtered by related Posts. It works.

Now i have an View for Veranstaltungen which i want to sort about the datefield inner the "Veranstaltung-date"

Thanks for an hint

#1971351

Hello, I understand you would like to sort a View of CPT Veranstaltungen by a date field. The date field exists in Veranstaltung_date - an RFG in the Veranstaltungen post type. Unfortunately there is no easy way to sort a View of posts by a custom field in its RFGs. Usually the simplest solution in this case is to create a View of the RFG and sort this View by the date field. In the results of the RFG View, you can display information about the parent post like the post title, link, and other custom field values. This approach will produce multiple rows for the same parent post, since each RFG row will contain information about the parent post and there can be multiple rows of RFG for each parent.

Another option is to use custom code and our PHP APIs for a custom solution. We offer an API that can be used to filter the results of a View programmatically, and an API that can be used to fetch RFs for a given parent post. By combining those two APIs, you could programmatically sort the results of a View of some parent post type based on custom field values in its RFGs. If you're not experienced with PHP development, the RFG View solution is probably more practical.

Views filter that allows you to manipulate the results / re-sort results: https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query_post_process
Post relationships API to find RFGs for a given post: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
I can offer more direct guidance with any of these APIs if needed, just let me know.

#1971891

Hi thanks for your answer. I try to use your answer: Usually the simplest solution in this case is to create a View of the RFG and sort this View by the date field. In the results of the RFG View, you can display information about the parent post like the post title, link, and other custom field values. This approach will produce multiple rows for the same parent post, since each RFG row will contain information about the parent post and there can be multiple rows of RFG for each parent.

But i cant seperate the RFG items correctly.- - i used [wpv-post-id item="@termine-veranst.parent"] to reference to parent view and in parent view i use for get RFG [wpv-view name="veranstaltungs-liste-date" wpvrelatedto="[wpv-post-id item='@termine-veranst.parent']"].

in my View output its give me always all RFG Fields per Data. Whats wrong: enlace oculto - there are only 4 Posts

thx - best regards - alex

#1972333

I think it would be best if I can log in and see how your Views and RFGs are configured, and where the View is displayed on the site. Can you provide login credentials in the private reply fields here?

Let me see where I can see these Views on the front-end of the site and I will take a closer look.

#1972445
7-programm-neu.png
6-kein-ct.png
5-remove-shortcode-atts.png
4-parent-post-view.png
3-new-qf.png
2-old-qf.png
1-content-selection.png

in my View output its give me always all RFG Fields per Data. Whats wrong
Okay I made a few changes and took some screenshots for your reference.

1. In the Content Selection panel of the RFG View, I deselected the parent post type Veranstaltungen and deselected the "Termine" RFG from another post type. It is confusing to have two Termine RFGs, so I suggest changing one of these in Toolset > Custom Fields > Post Fields. Do not change the slug, just change the name of the RFG.

2. Here you can see the old Query Filter settings for the RFG View, querying all post relationships and configured to respond to a shortcode attribute. It is not necessary to use a shortcode attribute in this filter configurations, since you will display the RFG View inside the loop of the parent post View.

3. Here is the updated Query Filter. I changed it to search only the Termine Group RFGs here (this will be faster than querying all possible relationships). The option "related to the current post in the loop" will perform better here, since this is a nested View.

4. On https://yoursite.de/programm-neu/, you can see the parent post View is placed using a View block.

5. I removed the old shortcode attributes from the new View shortcode.

6. I unassigned the empty content template "Template für Seiten" from the page Programm neu.

7. The list now appears on Programm neu. Is the sort order as expected? If not, please explain in more detail how the results should be sorted. Thanks!

#1973249

Hey - thx a lot! - That was it. -

The Question about Sorting/order - i would it order by RFG Date datum-und-uhrzeit.

best regards and thx again for your detailed explanation!

alex

#1974019

Okay I think this View is unnecessary:
enlace oculto

I think you can place the RFG View directly on the page and remove the post relationship filter, since you want to display all RFGs sorted by date. I've made this change for you here:
enlace oculto

Now you can see the results are ordered by the datum-und-uhrzeit field in descending order. If you'd like to change that to ascending order, edit the RFG View here and modify the sorting configurations:
enlace oculto

#2001777

hey - thx a lot for all. -

i have one Question about the RFG
in my view (veranstaltungs-liste-date) i would filter about the parent taxonomies.

But this is not working:

<div class="form-group">
	<label for="wpv-veranstaltungsart"></label>
	[wpv-control-post-taxonomy taxonomy="veranstaltungsart" type="select" url_param="wpv-veranstaltungsart"]
</div>
 

best regards - alex

Los hilos nuevos creados por Christian Cox y vinculados a este se encuentran a continuación:

https://toolset.com/es/forums/topic/filter-view-of-rfg-by-taxonomy-applied-to-parent-post/