Skip Navigation

[Resuelto] View to show child custom post type within a content template

This support ticket is created hace 8 años. 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 respuestas, has 2 mensajes.

Last updated by cathieH hace 8 años.

Assigned support staff: Luo Yang.

Autor
Mensajes
#276343
16-01-2015 14-47-29.jpg
16-01-2015 14-47-10.jpg
16-01-2015 14-46-57.jpg

I am trying to: show a child custom post type within a content template.

I have a parent custom post type of vendor and a child custom post type of vendor-review. I've a couple of vendors that have some dummy vendor reviews for them and I created a content template to display a single vendors content.

I visited this URL: hidden link

I expected to see: 3 vendor reviews underneath the vendor listing details.

Instead, I got: a blank.

I don't understand why.

I've attached a snapshot of my view's settings.

#276674

Luo Yang
Supporter

Languages: Inglés (English ) Chino simplificado (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

How do you setup the content template for single vendor post?

Please check this:
1) the post hidden link, does have child posts
2) Please try deactivate other plugins and switch to wordpress default theme, and test again

#276749
19-01-2015 11-44-16.jpg

Hi there Luoy,

NO there are no child items on this post. If there were they would show up right at the bottom under Vendor Reviews, there two reviews that should show up and they don't.

The basic twenty twelve theme is active and the only plugins that are active are Types, Views & CRED.

It still doesn't work properly.

Thanks
Cathie.

#276917

Luo Yang
Supporter

Languages: Inglés (English ) Chino simplificado (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

If the parent post does not have child posts, why do you expect to see:
3 vendor reviews underneath the vendor listing details.
https://toolset.com/forums/topic/view-to-show-child-custom-post-type-within-a-content-template/#post-276343

If the problem still exists, please duplicate same problem in a test site, and fill below "private detail box", and point out the problem View URL and page URL, I need a live website to debug this problem

#277159

Luo Yang
Supporter

Languages: Inglés (English ) Chino simplificado (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I have modified the problem content template:
hidden link

the codes from:

...
[wpv-view name="Vendor - Review Ratings & Comments"]

To:

...
[wpv-view name="vendor-review-ratings-comments"]

You are using special character "&" and " - " in the View title, so I suggest you try replace it with slug of View

More help:
Function ‘render_view’
Renders a view and returns the HTML output. This function takes an array as parameter, and you can pass one of these keys:

‘name’ => The View post_name
‘title’ => The View post_title
‘id’ => The View post ID

https://toolset.com/documentation/user-guides/views-api/

#277279

Thank you for your advice Luoy, I will remember this for other future builds.
🙂
Cathie.