Skip Navigation

[Resolved] Content template not applied to the post

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

Problem:
The user has created a content template but it is not being used in the frontend.

Solution:
It turns out that the user's theme does not have a proper template to display single posts(single.php or single-{cpt-slug}.php).
The default template index.php does make any calls to the_content() function from WordPress.

After creating a single.php file that contains the_content() call, the content template was correctly used in the frontend.

Relevant Documentation:

This support ticket is created 4 years 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: Africa/Casablanca (GMT+01:00)

This topic contains 12 replies, has 2 voices.

Last updated by matthiasV-2 3 years, 12 months ago.

Assisted by: Jamal.

Author
Posts
#1883831

The content template to the right here hidden link
Is not used for this post hidden link?

#1884247
clone-1883831.jml_eigendom_test-eigendom_.png

Hi there.

From what I gathered so far, the theme uses ACF and was never meant for Toolset. I assume that you started using Toolset after that. In fact, the theme includes 3 templates for 3 custom post types:
- single-projecten.php for the custom post type Projecten.
- single-producten.php for the custom post type Projecten.
- single-play_book.php for the custom post type Play Book(slug: play_book).
Read more about WordPress templates hierarchy here:
- https://developer.wordpress.org/themes/basics/template-hierarchy/
- hidden link

The new custom post type "eigendom" does not have a template in the hierarchy untill the most parent one "index.php":

<?php get_header(); ?>





<?php get_footer(); ?>

It only includes the header.php and footer.php files. Both files do not make any call to the_content() function or the_content filter:
- https://developer.wordpress.org/reference/functions/the_content/
- https://developer.wordpress.org/reference/hooks/the_content/

Toolset hooks into the_content filter to render the content template. Read more about it here https://toolset.com/documentation/programmer-reference/theme-support-for-content-templates/

I created locally a template by duplicating the single-projecten.php template and it displayed the content of the post(test-eigendom) as you can see it in the block editor. This template does contain a right sidebar, check a complete screen capture from my local test here attached.

If that's what you are looking to have, just copy the file "single-projecten.php" in the theme folder to "single-eigendom.php" and it will work. If you need further customization, check our article here:
https://toolset.com/documentation/customizing-sites-using-php/creating-templates-single-custom-posts/

If you are not comfortable with programming, you may need to hire a developer. Consider one of our partners here https://toolset.com/contractors/

#1884311

Hi

Displaying pages on half of the width is NOT a solution, NO. We want the pages to display as they should display, FULL WIDTH.
Moreover, we encounter this issue with the properties post type now BUT will also encounter the same issue with other post type pages (for agents, etc. etc.). So that's NOT a solution either, NO.
AGAIN, we are NO developers so even copying/pasting files in the theme folder is NOT what we can or do.
NO, we won't hire a developer to clean-up code that somebody else developed.
And if you send over snapshots in the future, it would be helpfull if we could see them properly.
This is how it is shown: hidden link

I hope you will show up with a valuable solution this time?

#1884913

Toolkit is even not working when creating new pages, please have a look at your test site and investigate.
What the template pages are concerned:
Our developer in de past made for 'projecten', 'producten' and 'play book' single php files with the requested functionalities. Custom fields were added via ACF.
Now, we would need to create a single-*slug (for example single-*slug eigendom) where we can then call the content?
But how?

#1886569
clone-1883831.jml_eigendom_test-eigendom_ (1).png

My apologies for the late reply, but I do not work on Wednesdays and Thursdays.

You can either create a single-* slug for each custom post type, f these files are not available in the Theme's directory WordPress will look for single.php. If it is not present it will default to index.php.
Unfortunately, the index.php does not contain a call to the_content() function. A simple fix is to just add the_content() call.
For example:

<?php get_header(); ?>
 
 <?php the_content(); ?>
 
<?php get_footer(); ?>

I tested this locally in a new file "single.php" and it displays the content template in fullwidth. Check the fullscreen capture here attached.
The file only contained the above code hidden link

If you are not comfortable with programming or you don't want to hire a developer to update your theme, I'll suggest that you consider migrating to a default theme such as 2020, or one of our recommended themes:
- https://wordpress.org/themes/twentytwenty/
- https://toolset.com/documentation/recommended-themes/

#1886695

so if i understand it well by just adding this code hidden link to every php file of each new post type all new content types will be displayed in fullwidth?

#1886699

Yes 🙂 adding the following code to multiple files named single-{slug-of-custom-post-type}.php, or to a single file "single.php", will display the posts(from post types created by Toolset) in fullwidth:

<?php get_header(); ?>
  
 <?php the_content(); ?>
  
<?php get_footer(); ?>
#1886725

can you add the code to the new post types created with Toolset and show us by video how exactly you did it? we have created a test site virtify.be to work on. i can share the login credentials from the hosting provider? or can you at least show us how we can do it ourselves?

#1886779

Your next reply will be private to let you share credentials for this test site safely.

#1886835

Here's another issue that we filed a support ticket for.

Can't create an archive or page with Toolset blocks.

I checked "show both the legacy and blocks interface and let me choose which to use for each item I build" in the "editing experience" section BUT creating a new archive or page doesn't bring up the blocks editor. See the attached screenshots.

hidden link
hidden link
hidden link

Please solve this as well.

#1886931

Well, creating a file inside the theme folder will depend on how your hosting provider allows it. Usually, you will have ftp access and some kind of user administration like cPanel.

For the sake of simplicity, I am using a plugin to add the file. I installed WP File Manager, and then created only one file "single.php" with the code and it should work for all custom post types that do not have a proper "single-slug.php" file.
Check this screencast hidden link

I took your other ticket into my queue and I'll be posting my replies on it later.

#1886961

We found a solution ourselves. You don't have to do anything anymore.

#1886963

My issue is resolved now. Thank you!