Skip Navigation

[Resolved] Cant assign template to new post type

This support ticket is created 7 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 10 replies, has 2 voices.

Last updated by Beda 7 years, 2 months ago.

Assisted by: Beda.

Author
Posts
#574927
content_item.PNG
content_template.PNG
dashboard.PNG

I am trying to: assign template to post type, that i create (SSL сертификаты)
On Content Templates page i see that for my content type in column Template used - correct template.

On dashboard in column Template - there is no template for my content type, and when i press Create template button it redirects me to Create layout page, but not to create template as in your video https://toolset.com/2016/05/toolset-2-1-preview-visual-composer-integration-content-templates/ and manual https://toolset.com/documentation/user-guides/benefits-of-templates-for-custom-types-vc
And on my page with new content type i cant see any changes that i was pade in content template assigned to this content type

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

I expected to see: content with my content templates.

Instead, I got: only text filed without any content templates.

Please check screenshotes^

#575014

When you have Views and Layouts, in the Template column will be listed the Layouts templates, not the Content Templates, and also it will create Layouts - since you cannot use Content Templates (or better, should not) on single posts when Layouts is active.
Instead, you should design the content with Layouts (either Template or Content Layouts)

Please head to your page in question, click on "stop using this layout" and then, assign the content Template, if you want to proceed with this approach.
Then you can also assign a Content Template there.

#575047

Thank you for quick reply.

I already done this recommendations before ask. You can see this on content_item.PNG in previous message.
I already select content template for "GeoTrust True BusinessID Multi-Domain" page, but it doesnt help, i still see simple page with title and text only.

#575586

Then I can only think that the theme does not use the_content() function to render the content.

In this case you can use only Content Templates and only if you add the Theme's Custom Content Function to the settings in Toolset > Settings > Front-end Content > Theme support for Content Templates

You can ask the Theme's developer about the exact function name, they should be able to provide you this information, in case the theme uses a non-standard function.

If that does not help, can you send me a Site's Snapshot with all the steps to follow so to see this issue?
https://toolset.com/faq/provide-supporters-copy-site/

Thanks!

#576122

Hello.

We are using this theme: hidden link

Here is what i found in template file single.php

at the begining

$post_format = get_post_format(get_the_ID());
$content = get_the_content(); ?>

and then

<?php 		
if( 'quote' == $post_format  ) echo '<blockquote>';
echo apply_filters('the_content',$content); 
if( 'quote' == $post_format  ) echo '</blockquote>';
?>	

I turn on debug mode and on created content type page i see: "Content Template debug: your theme does not provide a valid, dedicated function to render the post content."

Does it mean that my theme does not use the_content() function?
I can send you temporary administrator access so you could check settings.

#576137

And here is link to single.php file from my theme: hidden link
Maybe i can modify this file for child theme?

#576356

Your theme, if using the default WordPress Codex, should render the content in a loop with the function "the_content()".
https://developer.wordpress.org/reference/functions/the_content/

I cannot download that theme. Can you send me a copy in ZIP format? I can then try a few things, it is possible that you will need to create a Child Theme and in there a template following the standard WordPress Codex, or it might be that I can add the Theme's render function to the Toolset Settings, but your theme uses a variable populate with get_the_content() and then echoes this. This is not how it should be according to the Codex.

Let me see on a live copy of the Theme what I can do?

#576491

Here is link to download full theme:
<removed by admin since paid software>

#576768

In fact, your theme does not use the Codex recommended function the_content(), neither a Custom Function.
It populates a variable with get_the_content() and then echoes this.

There is nothing you can do in the settings of Toolset to make this work since there is no function called.

What you can do is create or use the child theme provided, and make sure either a custom function is handling the content, or, better, just use the WordPress provided API the_content().

This needs to be done for each file you will use in the Child Theme that displays content.

The very minimal need is to have the_content(); in your Loop.
This very function will then be replaced by Toolset Layouts or Toolset Content Templates - depending on what you choose.

Example Loop:

<?php 
if ( have_posts() ) {
	while ( have_posts() ) {
		the_post(); 
		//
		// Post Content here, best called with the_content(); This is then replaced by CT or Layouts. It can also be a Custom Function. This you would then add in Toolset Settings > Front End Content
		//
	} // end while
} // end if
?>
#576793

Hello.
Thanks for recomendation.

Is it possible to use this template modification only for post types that i created?

#576813

Well, basically in a Child theme you can modify each template that the parent has.
And, you can add more.
It will just follow the WordPress hierarchy - hence you could even create templates for each post type you create, or just let it fall back to let's say "single.php" for all posts:
https://developer.wordpress.org/themes/basics/template-hierarchy/