[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.
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":
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.
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?
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?
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:
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
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?
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:
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?
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.
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.