Skip Navigation

[Résolu] Right template is not automaticly attached to CPT

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.

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

Last updated by Dido Il y a 1 mois.

Assigned support staff: Waqar.

Auteur
Publications
#2164683
goed.JPG
fout.JPG

Hi,

On hidden link you see a view for the CPT "Anonce Post".
The posts are from users who use a Form.
When published, it is attached to the wrong template.
I thnik that this problem occured since I removed Views plugin and installed Toolset Blocks.

See images attached.

What is going wrong? It has worked for years.

#2165347

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

Is possible that your website includes some old custom code to override or dynamically assign content templates?

To troubleshoot this, I'll suggest the following steps:

1. Please make sure that WordPress, active theme, and plugins are all updated to the latest versions.

2. It would be interesting to test this with all non-Toolset plugins disabled and a default theme like Twenty Twenty-One.

If it's fixed, you can start adding the disabled items, one by one, to narrow down to a possible conflicting one.

3. In case the issue still persists, I'll need to see how this content template is assigned to this CPT in the admin area.

Let me know how it goes and I've set your next reply as private.

regards,
Waqar

#2169887

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing these details.

Durning testing on my website with a similar post form and content template, I couldn't reproduce this issue.

I used the check for updates button at WP Admin -> Plugins -> Add New -> Commercial and noticed a number of important updates for Toolset are still pending on your website.
( screenshot: hidden link )

Please update all these Toolset plugins and then test the form again. If the issue persists, I'll need a clone/snapshot of the website, to investigate this on a different server.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )

I've set your next reply as private.

#2169961

Hi Waqar,

the problem still presist.

I am not able to make a duplicator zip. I made a lot of filters, but still get "Host Build interruptie"

I can mak a backup of the website in Plesk. Is that also allowed?

kind regards

#2170125

Hi Waqar,

The problem still presists.
I'm not able to make a zip with Duplicator.
In spite of a lot of excludes, I keep getting errors.

Can I send you a zip from Plesk?
kind regards

#2171075

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting.

I managed to download the clone from the website using the Duplicator Pro plugin.

During testing, I couldn't reproduce this issue either on your website's clone or on the actual website.

I used the form "Annonce aanmaken" on the page "Annonce aanmaken voor Vraag en Aanbod" to add a new post "Test post title".
( you'll see it in the list of "Aanbiedingen" posts in the admin area )

Next, I checked that post's edit screen and noticed that the "Annonce Post" content template was properly assigned to it.
( screenshot: hidden link )

Can you please test this again and let me know the exact steps if you're still able to reproduce the issue.

#2171113
template.JPG

Hi,

I have checked the post, but it is not working yet.
You can check yourself in my website. I did not edit anything.

The template must be Annonce post, not dynamicly asigned

the other posts have the right template now, because I did it afterwards by hand.

#2171939

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

I think the confusion is caused by a little change in how the content template field looks now. A few months back a new feature was introduced through which you can assign multiple content templates to posts, based on conditions:
https://toolset.com/lesson-placement/lesson-placements-1621067-2019391/

When that feature was introduced, the design/look of the content template selection field was changed. As for the content template assignment part, it is working correctly, and in my screenshot from the last message, you'll see that the "Annonce Post" template is showing, under the select field with "template dynamically assigned".
( screenshot: hidden link )

As for the question why that template is not used on the front-end despite being correctly assigned, it is related to the "Enfold" theme, as explained in this errata:
https://toolset.com/errata/content-templates-dont-work-with-enfold-theme/

Since, this theme uses a non-conventional and non-standardized approach for showing the content on single post pages, Toolset's dynamically assigned templates are no longer compatible with it.

To ensure compatibility with the Toolset's content template feature, it would be a good idea to switch to one of our recommended themes.
( https://toolset.com/documentation/recommended-themes/ )

As a quick fix, you can replace the code at line# 189 in the file named "single-aanbieding.php", in your child theme's folder "enfold-BZ" and the assigned content template will start showing, on the front-end.

Existing code:


$content_output .=  $content;

New code:


$content_output .= the_content();

#2172073

My issue is resolved now. Thank you!