Skip Navigation

[Resolved] content template

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.

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

The Content template must to be assigned to the disconnected content

This support ticket is created 9 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 4 replies, has 2 voices.

Last updated by selenas 9 years, 2 months ago.

Assisted by: selenas.

Author
Posts
#278458
Screen Shot 2015-01-27 at 07.45.26.png
Screen Shot 2015-01-27 at 07.41.42.png

I am trying to display custom fields using VIews after creating a new content type ("pledge").

I've been able to customise the view for the pledges "archive" and create a view used as a "widget" to display the last created pledges.

My problem is with the display of custom fields in a single instance of "pledge". Only the 'post' part is being displayed.

've followed the procedure in the documentation which is to create a a "Content Template". It looks like it is never called.

<?php echo "Hello World"; ?>
[wpv-post-title]
[wpv-post-field name="impact"]<br/>
[wpv-post-field name="location"]<br/>
[wpv-post-field name="email"]<br/>

I've tried all the options "Use this Content Template for:" single pages or post archives, still nothing... I've tried to set the templates in the "Custome Fields" to no effect either...

This shouldn't be too complicated to fix, but I'm stuck.

#278561

Hi,

to display the custom post fields of a custom type you can:
- use the 'type' short-code, it should look something like:

[type field="impact"][/type]

- use 'wpv-post-field', to show the raw data from the field:
https://toolset.com/documentation/views-shortcodes/#wpv-post-field
The custom post fields name are saved with a prefix: "wpcf-" in the database.

To add the 'type' short-code you can use the "Views" button just above the 'content area' in the Content Template you defined, the custom post fields are under the "Details" section ("Details" is the name of the custom field group you declared)

In this link is shown How-to-Edit Content Template:
https://toolset.com/documentation/user-guides/editing-view-templates/

If the above solution didn't work, you may need to check if the content template is working with your theme. To know more about it, please, visit:
Views >> Settings >> Theme support for Content Templates.

Let me know any questions you have about this.

#278596

Thank you Selenas for your detailed feedback.

I'm using "Active" as a theme. I have been looking in the PHP files:
* blog.php: Blog (full posts) Page Template uses" the_content" once
* content-right-page.php also
* ... and a few others

<?php the_content( __( 'Read more ›', 'responsive' ) ); ?>

The debugger works everywhere, but on the full posts / pledges (the extension of posts I've defined).

What should I try next???...

#278628

Well, Selenas, problem solved!

When I edit a "pledge" (extended type) I have the option to set its template. It works!

So the trick was (after too many hours) to set the template after editing the instances of the extended type that was created before.... their extension...

So, there was one step missing (for the casual user of WP) to connect a new type to a template: As the extended type is created before its template, it is necessary to go back to the extended type to set the right template (this is explained in the doc, but not elicited enough probably — a small schema might help). Setting the link to the template in the extended type will only work with the instances created after everything is in place. For the existing instances that have been "extended", it is done through editing the instance directly.

Sounds logic 🙂

Have a great day, and thanks again for your help.

Serge

#278761

Hi,
Thanks for sharing your solution, it may help other clients.

Just for your information, this issue can be fixed in two way:
- the first one is the solution you provided. Reassign the Content Template to the custom post type/post/page. Or,
- you can do it by using the "Apply to All" in the Content Template editor. See step 5 here:
https://toolset.com/documentation/user-guides/view-templates/

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.