Skip Navigation

[Resolved] I’d like to show parent taxonomy on child archive page template within blocks

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

Problem:

I want to show taxonomy terms of parent post in archive page of child post types.

Solution:

You can use a content template to display parent post information, for example:

https://toolset.com/forums/topic/id-like-to-show-parent-taxonomy-on-child-archive-page-template-within-blocks/#post-1712243

Relevant Documentation:

100% of people find this useful.

This support ticket is created 4 years, 4 months ago. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 10 replies, has 2 voices.

Last updated by SteBlood 4 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1709237
screenshot2.png
screenshot1.png

I want to show screenshot 1 (Taxonomy term image field inside parent 'caravan park' CPT)
hidden link
In
Screenshot 2 (Child post 'Holiday Homes' CPT archive page)
hidden link

On the caravan park page, the images are output via a view.

Many thanks for your help!

#1709669

Hello,

In the 'Holiday Homes' child CPT archive page, you can create a taxonomy view and display the Taxonomy term.

For example:
1) Dashboard-> Toolset-> Settings-> General
in section "Editing experience", enable option "Show both the legacy and Blocks interface and let me choose which to use for each item I build"

2) Dashboard-> Toolset-> Views
Create a taxonomy view:
- Query terms of your custom taxonomy
- In view's loop display term's information

3) Edit 'Holiday Homes' child CPT archive page, display above views.

#1709857
screenshot2.png
SCREENSHOT1.png

Hi Luo,

Apologies for bothering you again, but thank you for your time.

I tried this already (screenshot 2), however, I think the problem I am having is, because I am showing this on my child archive page, the parent taxonomy images are not showing.

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop>
		[wpv-post-body view_template="loop-item-in-site-features-taxonomy-images-holiday-home-archive"]
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

I also tried to use a nested view (screenshot 1), which had the above view inside another view which was filtered by relationship and that didn't work either.

[wpv-layout-start]
	[wpv-items-found]
<center>[wpv-view name="site-features-taxonomy-images"]</center>
	<!-- wpv-loop-start -->
		<wpv-loop>
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"][/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

Or am I reading your reply wrong?

Honestly, as I've tried a few different ways, I think I've confused myself and now I am confusing you.

#1709889

I tried this;

[wpv-view name="site-features-taxonomy-images-mobile" item="@caravan-park-park-stock.parent"]

This didn't work :'D

I am trying!

#1709891

Please provide your website credentials in below private message box, also point out the problem page URL and view URLs, I need to test and debug it in a live website, thanks

#1709919

I assume we are talking about this taxonomy view "Site Features Taxonomy Images (Mobile)":
hidden link

You are going to display above taxonomy view outside WordPress archive loop, this is a known issue, see the erratum:
https://toolset.com/errata/content-template-is-not-rendered-if-added-outside-the-archive-loop-of-a-view/

Toolset lets you style WordPress archives. You can insert anything in the Loop Editor of those archives including Content Templates.

However, there are two cases where Content Templates will not display:

If you insert Content Templates outside the wpv-loop HTML tags.

Please try the workaround mentioned in above erratum:
The recommended workaround is to not use Content Templates to group fields in a Taxonomy View.

Display them directly, without content template.

#1709933
screenshot4.png

Hi Luo,

I am a little confused.

This hidden link
is within the wpv-loop HTML tags. Please take a look at the code;

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
<h4>Site Facilities</h4>
	<wpv-loop>
		[wpv-post-body view_template="loop-item-in-site-features-taxonomy-images-mobile"]
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"][/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

Then I want to place it within the archive loop (screenshot 4)
hidden link

As far as I can see, I am trying to place this information into a loop.

If I am wrong I am sorry, if I am right, I think I may have confused you and I am again sorry for that!

Thank you for your help

#1709961
screenshot5.png

I did something similar, but this was on the same CPT archive where the information is stored (screenshot 5)

However, I want this information to show on the Child CPT archive page as well.

#1712233

I am checking it in your website, will update here if find anything

#1712243

I have done below modifications in your website:
1) Create a content template "Caravan Parks information":
hidden link
Display the taxonomy view shortcode:
[wpv-view name='site-features-taxonomy-images-mobile']

2) Edit the WordPress archive:
hidden link

In the loop, display above content template shortcode:
[wpv-post-body view_template="caravan-parks-information" item="@caravan-park-park-stock.parent"]

Test it in front-end:
hidden link

It works fine, please check if it is fixed, thanks

#1712485

My issue is resolved now. Thank you!