Skip Navigation

[Resolved] content templates not working

This thread is resolved. Here is a description of the problem and solution.

Problem:
A Content Template has been created for a custom post type that outputs custom fields for its posts. It's not working, the post displays like a standard blog post and doesn't appear to use the template.

Solution:
Most themes use the standard WordPress the_content() function to render the post content, and that is what Views Content Templates (and Layouts templates) replace.

If the theme uses a non-standard way of outputting the post content the Toolset template will not be used.

For themes that use a dedicated custom function to output the content, that function can be registered with Views and the content templates should then work. (The same is not possible with Layouts.)

Otherwise it is necessary to edit the theme template files to use the_content() for the post content.

Relevant Documentation:
https://toolset.com/documentation/user-guides/editing-view-templates/theme-support-for-content-templates/

100% of people find this useful.

This support ticket is created 6 years, 2 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by malagaS 6 years, 2 months ago.

Assisted by: Nigel.

Author
Posts
#610548

I am trying to: create a content template for a cpt but fields in template are empty when viewing the post.

Link to a page where the issue can be seen:hidden link

I expected to see: post title and some other fields.

Instead, I got: nothing.

#610554

it appears to be a problem with the uncode theme. when switching to default theme I see the data.

#610682

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

Standard themes use the_content() to output the content part of a post, and this is what Views (or Layouts) replace when you create a custom template for a post type.

For non-standard themes, those which use an alternative function to output the content can be made to work with Views by registering that function, as described here: https://toolset.com/documentation/user-guides/editing-view-templates/theme-support-for-content-templates/

For non-standard themes which do not use a specific function to output the content, the only alternative is to edit the theme PHP template in question (using a child theme) and to replace the part used to output the content with the standard the_content() function. Take a look at the standard twentyseventeen theme to see what is involved.

#612579

I ended up changing themes - suddenly had multiple issues after a theme/wp update. thanks!

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