Skip Navigation

[Resolved] Template assignement dosn't work

This support ticket is created 3 years, 6 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 3 replies, has 2 voices.

Last updated by Waqar 3 years, 5 months ago.

Assisted by: Waqar.

Author
Posts
#2150485
Dosnt work.png
Works.png

Hi,

We have custom post types that all have their own content templates assigned.

However when saving posts the content templates dosnt get assigned in the right way.

It says "Template Dynamically Assigned by Toolset" but the template dosnt work and we have to manually select the template every time.

Do you know any solution to fix this issue?

#2151053

Hi,

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

If a content template is globally assigned to a single post type, it shouldn't be required to be assigned to individual posts, manually.

Can you please share temporary admin login details, along with the exact steps to see the issue?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#2158365

Hi,

I managed to debug this problem

We where checking for possible templates in our theme code like this

if (function_exists("render_view_template") && get_post_meta($post->ID, '_views_template', TRUE) && get_post_meta($post->ID, '_views_template', TRUE) !== 0) {

For some reason the automatically assigned template dosn't have _views_template meta in post meta anymore

It seems this still works so I'll use it instead

has_wpv_content_template($post->ID);

#2159673

Thanks for the update and your observation is correct.

In Toolset Blocks 1.5 / Views 3.5, some changes were added to the content assignment mechanism, to introduce the conditional assignment feature.
( ref: https://toolset.com/2021/04/toolset-blocks-1-5-custom-woocommerce-product-and-shop-pages/ )

The assigned template's ID is no longer saved in the "_views_template" meta, but it is still safe to use the "has_wpv_content_template" function.
( ref: https://toolset.com/documentation/programmer-reference/views-api/#has_wpv_content_template )