Skip Navigation

[Resolved] Creating view for related post types in a content template not working

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 6 replies, has 3 voices.

Last updated by Minesh 1 year, 9 months ago.

Assisted by: Minesh.

Author
Posts
#2607439
content-template-not-a-view.png
screenshot-error-no-view.png
screenshot-make-view.png

Tell us what you are trying to do? I want to list items in a related custom post type, and I'm following the video for displaying related post types, but it doesn't work. Instead of creating a view, it creates another content template, and I see it in the editor, but not the front end. If I save and exit the editor, and come back, it shows where I created the "view" but says no view exists. It never shows on the front end.

Is there any documentation that you are following? https://toolset.com/course-lesson/displaying-related-posts/

Is there a similar example that we can see? See uploaded screenshots

What is the link to your site? hidden link

#2607517

Nigel
Supporter

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

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

Hi there

From your screenshots it looks like you created a template for Treatment posts and added a View to that template, which is set to show related Facilities posts.

But something has gone wrong (your View not found screenshot). I'm not sure what is listed on the Content Templates page that you highlight.

I think it would help if we could access the back end of your site to take a look and see if we can identify the problem, would that be okay?

Let me mark your next reply as private so that we can get log-in credentials from you—you may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.

#2607793

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I checked on the content template edit page and like you I also see the message "view not found".

You maybe forget to save the page/content template after you created the view but when I try to add the view block it shows me two views (NivoSlider and TreatmentOffered) - do you want to use any of those views?

Also, I've disable the Layouts plugins as its not required.

#2607817

The TreatmentOffered View is one I set up because I was trying another way. It doesn't work either. If you go into the Facilities Content Template, you'll see that view at the bottom now, although you can't see it in the editor unless you hover over it. It says it can be edited in classic view, which is weird. Nothing shows on the front end.

If you try creating a new view from a template you'll see the behavior. You can step through the process just in the video on creating related post type content. It looks fine as you build it, and you can see the list in the editor. And I DID save it. but you can't see it on the front end. When you exit the editor and come back, you'll see the "view not found" error. And sure enough that view isn't there, but it IS there as a content template.

So why would Toolset be doing this, making it a content template and not a view?

#2608619

Hi.

I'm at a stand still on my project. Is there anything you can do to help get this working? It does seem like a bug.

I may have to try a new site out and see if it works. This site has been there a long time and using the old version of the Types plugin to create the custom post types.

#2608851

The video doesn't show how to make a view first and then add it to a content template.

I have figured out how to add the view to the template. I'm still trying to understand how best to do this, but if I make a view first and not create it from the content template editor, I can then add it to a content template and it is working. It still seems like a bug but I am ok with the alternate process as long as it works.

I have one specific question. I would like to have a general content template that will be used for multiple post types: Facilities, Research-Resources, Health Conditions. I currently have a template called "Template General for Single".

This would be easier than making a separate template for each post type. The problem is that I want to suppress the view that references itself. So if we go to a resource (hidden link), I don't want it to list resources. I think i can set up a condition but don't know how to do that. Can you tell me how or if this is possible? If you think it is better to create a separate template for each post type I can do that instead.

#2608973

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Have you checked that you can assign the template to multiple post types and also set the conditions.

Please check the following doc:
- https://toolset.com/course-lesson/assigning-templates-to-posts-conditionally/