Skip Navigation

[Resolved] Multiple templates for custom post type

This support ticket is created 5 years, 9 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Mario Hernandez 5 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#1202219

Hi!

i need to create a landing page with a special view of a custom post type, showing only the needed posts in a map (it's a directory of the schools -we have a lot of people in the directory, but in this case we only want the schools to be shown in a map).

We have succesfully created this view with a conditional filter in the loop (at the bottom of hidden link), and all worked seamlessly. However, we need the results to link, no to its official single page original content template but another content template for single items. In this case, the content template will include some information that completes the commercial proposal.

So, the issue is that we need each item to use a special content template, and not the original only in this case.

We cannot change or edit the main content template for this custom post type because it's already in use in the official directory page (hidden link)

How do you think could I create another template for the single view of the posts, when the original template is in use? This is the original template for single items: hidden link

We need to create another single content template with different information without modifying this one that is in use. Only in this other content template we will show a more targeted information, with course plans and academic info.

Thank you!

Mario

#1202359

Hi Mario,

Thank you for waiting.

Please consider this example view, which shows information from a single post, by getting the ID value from the URL:

1. In your view's "Content Selection" setting, you'll select the post type that you'd like to show on the landing page.
Screenshot: hidden link

2. In the "Limit and Offset" section, you'll select "1", as this view will be used to show information from only 1 post.
Screenshot: hidden link

3. In the "Query Filter" section, you'll add a "Post ID" filter, that will include only the post, whose ID exists in the URL parameter.
Screenshot: hidden link

Note: By default, the URL parameter "post_ids" value will be used, but you can change it to something different like "id" as well.

4. After that, when you'll insert this view in your landing page ( e.g. hidden link ) and append the URL parameter with the required post's ID ( e.g. hidden link ), the landing page will show information from that post.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1202390

Thank you Waqar for your great solution.

I am working to implement it and have found some difficulties.

1. I have created this page as landing page for your step 4, with the URL param "ecole": hidden link

In this page I have inserted this view (please, note that the custom toolset post is "Annuaire membres" and not "posts" from the core wordpress): hidden link

2. I have inserted the content template in the loop of the view, edited with divi builder (hidden link and hidden link)

You can view the content of those modules here: hidden link

I have tested the page with one of the available posts and it renders no output: hidden link

Do you imagine where could be the problem?

Thank you Waqar,

Mario

#1203148

Hi Mario,

Thanks for writing back and for sharing these details.

Your steps seem to be correct, but the "[wpv-post-body]" shortcode that calls the content template in the view, needs to be between the <wpv-loop>...</wpv-loop> and not outside it.
( screenshot: hidden link )

Please update this and then check the view's output again.

regards,
Waqar

#1203278

All solved! You can access to hidden link to test it.

Thank you Waqar for your kind support!