Skip Navigation

[Résolu] How to use Layouts and Content Templates with the UNCODE theme

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 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.

Our next available supporter will start replying to tickets in about 2.10 hours from now. Thank you for your understanding.

This topic contains 13 réponses, has 4 voix.

Last updated by Christian Cox Il y a 3 années et 10 mois.

Assigned support staff: Christian Cox.

Auteur
Publications
#581609

I am trying to: using the plugin

Link to a page where the issue can be seen: hidden 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.

Thank you so much for any helps

#581833

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

See the following screenshot:
=> hidden link

could you please check what function your theme using to display the content. with the following Doc:
=> https://toolset.com/documentation/user-guides/editing-view-templates/theme-support-for-content-templates/

#584792

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 ?

Thank you

#584893

Hi, Minesh is away this week so I've been asked to follow up on his tickets. I hope that's okay with you. I've seen other tickets related to the Uncode theme and compatibility problems. Luo was able to make a recommendation here that seemed to resolve the problem:
https://toolset.com/forums/topic/content-template-for-new-custom-post-wont-display-content/#post-434302

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.

#584911

Hi Christian,

I'm sorry but I changed it and it still doesn't work => hidden link

#584947

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.

#586881

Okay thanks, I was able to create the clone. I will start those tests and get back to you shortly.

#586897

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.

#587096

Hi Christian,

It's look working !! thanks a lot !! and just last question, do you know why it didn't work before? It was the single-event_new.php or the template ?

thank you !!!

#587099
#587194

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.

#587218

Ok great, I understand better.

Many thanks

#595116

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.

#595375

Travis - please create a new ticket so we can help resolve this issue for you as soon as possible. Thanks!