[Gelöst] How to use Layouts and Content Templates with the UNCODE theme
Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.
Problem: I'm unable to get a Content Template to show up for my Custom Post Type. I'm using the UNCODE theme and Layouts.
Solution: If you're using Layouts and you have assigned a Layout to the CPT, your Content Template will have no effect on the page design, because Layouts override Content Templates. You can design the main content area using Layouts, or you can insert a Content Template cell to use the design from a Content Template. No PHP changes should be necessary.
This support ticket is created vor 7 Jahren, 1 Monat. 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.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
Link to a page where the issue can be seen: versteckter Link
I expected to see: My CPT
Instead, I got: Nothing
Hi everybody,
I'm using Toolset for a new website but the plugin doesn't really work with my theme. I have created a CPT to add a new events in my website and when I call them nothing appening on the page.
I have tried with the twentyseventeen theme and it's working, so I think is my UNCODE theme.
I have tried to figure out with this documentation https://toolset.com/documentation/user-guides/layouts-theme-integration/ but nothing are really explain in details.
Hello. Thank you for contacting the Toolset support.
Well - based on the debug information you shared with me I can see that you are using outdated Toolset plugins.
*** Please make a FULL BACKUP of your database and website.***
We always recommend to run with latest Toolset plugins. Could you please update ALL Toolset plugins to it's latest official released version and try to resolve your issue. You can download the latest Toolset plugins from:
=> https://toolset.com/account/downloads/
Now, regarding your issue, the problem URL you shared is not working at this end. As you are displaying the single post page:
Content Templates modify the content when called from the WordPress’ built-in the_content function. Some themes DO NOT use the_content function, but define their own function. In this case, Content Templates are not applied to selected posts on the front-end.
Many thanks for your help, so I updated every plugins and add the content template debug.
Now I have this message "Content Template debug: your theme does not provide a valid, dedicated function to render the post content"
Does it mean I have to change my template ?
There have been updates to the theme since then, so the line numbers may have changed, but the solution remains the same. Please let me know if you're able to make the modification he mentions in the single.php file.
Okay it's probably best for me to make a clone of your site so I can run some tests locally. If that's okay with you, please provide login credentials for your site in the private reply fields here. I will install the Duplicator plugin and begin creating that clone.
Okay I wasn't able to get a Content Template working, but I was able to make a few changes and have a Layout show up correctly. Here's what I did:
- Rename the single-event-new.php template file on your server to temporarily disable it for now. Call it single-event-new-backup.php
- Go to Toolset > Layouts > Template For Events New 1 and add a Visual Editor cell here. Place some test text in the editor and save the post.
- Reload event-new/john-conneely-inc/ to see the updated Layout.
- If you want to use Visual Composer, you must first go to Toolset > Content Templates to create a Content Template. You can use the Visual Composer builder here if you'd like. Then go back to your Layout and insert a Content Template cell to show the design you created in Visual Composer.
Let me know if this will work for you, or if you experience difficulty.
The Layout assigned to this post type was empty, which was the main problem. Layouts assigned to a post type override Content Templates assigned to a post type, so the empty Layout was shown instead of the Content Template. I don't think the extra PHP template file is required, unless you need to make modifications outside of the main content area. Most of the time that's not necessary, and a Layout will be sufficient to help you design the main content area.
Hi I'm having a similar issue with an Uncode site.
The layout isn't empty and from what I can tell it's properly assigned to the post type though when viewing on the frontend the content area's empty. Have tried multiple layouts (some with views, others with just simple text from a visual editor cell). Searching for the test content in the html source also comes back with nothing — content isn't being loaded.
If I turn off the layout for the post type and try to view the post on the frontend I get the warning "This page doesn't have a template layout"... so I know it's at least calling for a layout, but when one's assigned it's not displaying its contents.
I also don't have a corresponding single-[posttype].php file in my theme per the previous poster's setup.