Hello,
how can I integrate a custom php template into toolset layouts?
Hey I couldn't send a chat message on safari mobile. It seems to be a bug.
Anyways, I have created a single-{cpt_slug}.php file
Inside the file I called get_template_part(). But now I am unable to render the output from those files.
I am using toolset layouts
And was wondering how I can render the output from the file instead of the layout?
And assign a custom php template to a page.
Regards,
Nick
Dear Nick,
I suggest you create a custom shortcode using PHP codes, output the content of your "php template", then put the shortcode into layout.
More help:
https://codex.wordpress.org/Function_Reference/add_shortcode
Thanks Luo. I got it to work.
Just wondering why doesn't Layouts let me render my custom php template?
I can not deactivate Layouts for a CPT.
Only if I deactivate the entire Layouts plugin it will work.
The Layouts plugin works like a page visual editor, it does not support PHP codes directly, you can render layout content insider post content area, or you can edit your theme file, use function the_ddlayout() to render the layout content, see our document:
https://toolset.com/documentation/user-guides/develop-layouts-based-themes/#php-integration-for-layouts
Hm... I need the default wordpress theme function to work. Is that supported with the layouts plugin?
Please elaborate the question with more details:
What kind of default wordpress theme function do you want to work and supported with Layouts plugin?
Please describe detail steps to duplicate the same problem. thanks
I have created a single-{cpt_slug}.php file
Inside the file I called get_template_part(). But now I am unable to render the output from those files.
If I deactivate the layouts plugin. It will work.
But for some reason the layout functions are overriding the custom php template.
I have tried it in my localhost in a fresh wordpress installation, there isn't similar problem.
I suggest you try these:
1) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2017, and test again
2) Save that specific layout(it will clear all cache related with that layout), and test again
3) If the problem still persists, please provide a copy of your website, also point out the problem page URL and layout URL, and the problem theme file(single-{cpt_slug}.php), I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/