Skip Navigation

[Résolu] View data not showing up

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

Problem: I have a View that is ordered by a custom field. No results are displayed.

Solution: Make sure the field has content in any post you want to show in the results. Make sure the appropriate field is selected in the filter, because sometimes fields have the same or similar names.

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.

Marqué : ,

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

Last updated by prasadS Il y a 2 années et 2 mois.

Assigned support staff: Christian Cox.

Auteur
Publications
#1236600

I am trying to: Display a view inside a layout. I have a custom post type named 'Hotels' and a custom post type named 'Reviews. They have a one-to-many relationship. Each hotel can have multiple reviews. But the reviews are not showing up.

Link to a page where the issue can be seen: hidden link

I expected to see: List of reviews.

Instead, I got: No reviews.

#1236677

Christian Cox
Supporter

Languages: Anglais (English )

Timezone: America/New_York (GMT-04:00)

Hi, can you take screenshots of the View in wp-admin so I can see how your Query Filter is configured?

#1236843
Screenshot 2019-04-29 at 1.48.59 PM.png

Attached is the screenshot showing the query filter.

#1237051

Christian Cox
Supporter

Languages: Anglais (English )

Timezone: America/New_York (GMT-04:00)

I can see your Ordering settings are based on a custom field Review Date. Since you are sorting based on that custom field, if the Reviews do not have a set Review Date, then they will not appear in the search results. It's a quirk in the way WordPress queries work. If you change the ordering to Post Date instead, do the Reviews appear?

#1237528

I changed the sorting from 'Review Date' to 'Post Date'. The reviews started appearing.

I am now rechecking the review date for each review. This is a bit strange as the 'Review Date is a required field.

I will recheck and get back shortly.

#1237530

I checked. Each review has a review date. It is a required field.

#1237750

Christian Cox
Supporter

Languages: Anglais (English )

Timezone: America/New_York (GMT-04:00)

Okay is it possible there is more than one custom field called Review Date, and the wrong Review Date field is selected in the Ordering options? Sometimes this happens if fields are renamed or deleted incompletely. If that is not the case, I will need to take a closer look. Please provide login credentials in the private reply fields here and let me know where I can find this View on the front-end of the site.

#1237769

I checked the list of custom fields... found a field named 'Review Date' with the slug 'review-date' It was not linked to the Reviews custom post type fields group. Deleted it.

Then selected the correct field 'Review Date' with the slug 'reviews-date'. The reviews are now showing up.

Thank you for the help 🙂