Skip Navigation

[Resolved] view that doesn't show the second parent of a child view

This support ticket is created 7 years, 7 months 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+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by Juan Ignacio Tel 7 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#438065
code.png
img1.png

I am trying to: There are two views that yesterday worked and today don't. The problem is that instead of showing the parent post type show the child post type. It is strange because the same post type work in other places of the site. I have one child post type called publication-authors whose parents are publications and authors. I have one view that works that displays the authors of each publications but suddenly the view which showed the publications of each author doesn't work and shows the publication-author. The same happens with another view that is displayed in the same custom template that sould display one field of the parent view but it displays the publication-author too

I visited this URL:

I expected to see: the publications of each author with a link to each publication

Instead, I got: some publication authors and some titles with a wrong link

#438341

Nigel
Supporter

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

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

If it worked yesterday and not today, what has changed? What were you working on? Do you have a backup for yesterday that you can revert to?

So you have set up many-to-many relationships using an intermediate post (publication-authors) which is a child of your custom post types publications and authors.

Your view which shows the authors of a publication works.

Your view which lists the publications of an author does not.

I would compare the two and note the differences, one or more of which should explain why the second view is not working.

The view should return your intermediate posts (publication-authors).

It will need a query filter to specify posts which are children of the "current" author, which depends upon where this view is being shown (so it will be determined by the page where this view is shown or the current item in the loop).

In your loop output section you will use the id="$author" to specify that the shortcodes to display content will get it from the parent author post and not the current intermediate post itself.

In testing, it is not a bad idea to add a shortcode to the loop output section which does notuse the id attribute, so that you can confirm that the correct intermediate posts are being returned. For example add [wpv-post-title] and for a given author if you are expecting to see 3 publications, make sure you are seeing 3 intermediate posts, and that they are the correct ones.

So then you can determine if the problem is whether the correct posts are being retrieved, and, if so, if the problem is more of a presentational one, that we have the correct intermediate posts but are failing to display content from the correct parent.

If you could do something like that and get back to me it would help narrow down the problem.

#441176

Thanks for your suggestions Nigel 🙂

We've traced it and found what was faulting: a change in the slug of parent's CPT.

It's odd because such change was made several days ago and we're quite sure that, after it, we reviewed all the site looking for errors... and nothing was found on this view.

It seemed as if the error appeared from one day to the next, and such thing confused us.

We take note of your indications and will use them for further debugging. 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.