Skip Navigation

[Gelöst] Get "Template Dynamically Assigned" via PHP

This support ticket is created vor 2 Jahre. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 2 Antworten, has 2 Stimmen.

Last updated by beatR vor 2 Jahre.

Assisted by: Minesh.

Author
Artikel
#2354167

Hi!

on a given post, i need to get the template that toolset would assign automatically. is there a PHP function for this?
i just need the ID or the name of the template.

Thank you!

#2354257

Minesh
Supporter

Languages: Englisch (English )

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

Hello. Thank you for contacting the Toolset support.

After the update to Toolset Blocks 1.5, we introduced a new way of handling single post pages with content templates. Now we have conditions and priorities to determine what content template to use on a post to display on its single post page. You will need to pass the post's object ($post) to it:

For example:

$template_id = apply_filters( 'wpv_content_template_for_post', 0, $post );
#2354263

Hi Minesh

amazing. exactly the drop-in line of code i needed . thanks a bunch for the concise and quick answer.

Kind regards
Beat

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