Skip Navigation

[Resolved] taxonomies in wordpress archive

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

Problem:

The issue here is that the user wanted to create a taxonomy view with a post view to display their information in the format.
Taxonomy A
- Custom post type 1
- Custom post type 2
- Custom post type 3

Taxonomy B
- Custom post type 4
- Custom post type 5
- Custom post type 6

Solution:

This can be done by using our nested view setup. I would recommend taking a look at our documentation below in order to set this up
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/#taxonomy-view-with-a-post-view-for-a-child

This support ticket is created 5 years, 2 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 14 replies, has 2 voices.

Last updated by David Gimenez 5 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1343351

Hi there. I'm trying to get a nested estructure in wordpress archive

I'd like to get

Taxonomy A
- Custom post type 1
- Custom post type 2
- Custom post type 3

Taxonomy B
- Custom post type 4
- Custom post type 5
- Custom post type 6

If I create a page with nested views... works perfect... but I'd like to get this in wordpress archive.

Why? Because I have a breadcrumbs

Services -> Service A. If I click in service shows all services no categorized and I like to get custom post types categorized

I tried a lot of options without success

Also I read posts and posts in support... but nothing that to help me?

Can U show me a light to get this?

Thanks in advanced

David

#1343409

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-09-18 at 4.34.45 PM.png

Hi David,

Thank you for getting in touch.

Take a look at my screenshot for my filter that i'm using to display my posts.

So I set my taxonomy filter on the view to be filtered by a shortcode parameter and filter using the slug of the taxonomy.

When I add this view shortcode to my archive, I add it like this.


[wpv-view name='my-view' wpvcourselevel='[wpv-taxonomy-slug]']

As you can see i'm passing the taxonomy slug into the view to list out the posts with that taxonomy.

Please let me know if this helps.
Thanke

#1343657
Captura de pantalla 2019-09-19 a las 8.41.01.png

Hello Shane. First of all.... thanks for your answer.

1. I attached an screenshot of that I want to do. That screenshot is from other site where i have a page with a nested view. I want to do the same in archive page.

2. I tried that you wrote me here, but I have some problems because i think that I don't understand it.

Following your instructions I created a view filtered by a shortcode parameter and filter using the slug of the taxonomy. I can access to the posts filtered like this [wpv-view name='areas-levels' wpvtipologia='derecho-mercantil']. It works fine if I write the slug and I insert it in a page. However... I don't know where I can insert that shortcode in archive to get all posts filtered by taxonomy like as my screenshot.

And... how can I get taxonomy slug if the posts inside the archive?

Thanks again for your help Shane!

#1343995

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

I had mentioned it in my previous post.

You can use the [wpv-taxonomy-slug] shortcode to get the taxonomy slug.

This should result in what you want to achieve in the screenshot.

Thanks,
Shane

#1344371

Hi again Shane, and sorry to disturb again, but I think that I amb doing anything wrong.

I created the view areas-levels that list services (posts) and have this filter -> Tipologias slug (taxonomies) en uno de lo definido por el atributo del shortcode de la view wpvtipologia --> p. ej., [wpv-view name="view-name" wpvtipologia="xxxx"]

I have services archive that show all servicios and the loop editor output is

[wpv-layout-start]
	[wpv-items-found]

	<!-- wpv-loop-start -->
	<wpv-loop wrap="1" pad="true">
		[wpv-item index=1]
		<div class="row ">
			<div class="col-md-12">[wpv-post-body view_template="loop-item-in-servicios-archivo"]</div>
		</div>
		[wpv-item index=other]
			<div class="col-md-12">[wpv-post-body view_template="loop-item-in-servicios-archivo"]</div>
		[wpv-item index=pad]
			<div class="col-md-12"></div>
		[wpv-item index=pad-last]
			<div class="col-md-12"></div>
		</div>
	</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]

Where must I insert [wpv-view name="areas-levels" wpvtipologia="wpv-taxonomy-slug"]?

Thanks in advanced for your kind help

#1344527

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

You need to add it within the "loop-item-in-servicios-archivo" template for your archive.

Also the code should be
[wpv-view name="areas-levels" wpvtipologia="[wpv-taxonomy-slug]"]

Thanks,
Shane

#1344541

Hi again Shane.

It doesn't work.

I think that we're talking about different things. From the beginning to know.

1. areas-levels is a view that show services and have a filter filter -> Tipologias slug (taxonomies) en uno de lo definido por el atributo del shortcode de la view wpvtipologia
2. Servicios archives is a wordpress archive that list services and i use the view areas levels in loop item editor in this way: [wpv-view name="areas-levels" wpvtipologia="[wpv-taxonomy-slug]"]

The result is hidden link instead of hidden link.

Thank you again for your patience

#1344557

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Would you mind allowing me to have admin access to the site to check on this for you ?

Please send me a link to the archive where you are viewing this.

Thanks,
Shane

#1344581

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

I found the issue.

You custom archive is a Post Type archive so it won't work like this. However there is a workaround.

You mentioned that you've done this with views but you want it on your archive.

So what you can do is to add that view that works to the archive itself.

Right now you have


	[wpv-items-found]
[wpv-taxonomy-slug]
	<!-- wpv-loop-start -->
	<wpv-loop wrap="1" pad="true">
		[wpv-item index=1]
		<div class="row ">
			<div class="col-md-12">[wpv-post-body view_template="loop-item-in-servicios-archivo"]</div>
		</div>
		[wpv-item index=other]
			<div class="col-md-12">[wpv-post-body view_template="loop-item-in-servicios-archivo"]</div>
		[wpv-item index=pad]
			<div class="col-md-12"></div>
		[wpv-item index=pad-last]
			<div class="col-md-12"></div>
		</div>
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]

So what you can do is to add your nested view that works to this.

	[wpv-items-found]
You view shortcode goes here
	[/wpv-items-found]

So instead of the archive producing its own loop, it is using views to generate the content in the format that you want since you mentioned that you've achieved this with views.

Please let me know if this helps.

Thanks,
Shane

#1344621
Captura de pantalla 2019-09-19 a las 23.12.54.png

Hi again Shane. Thanks for your help and your time.

I tried this but without success. I attach and screenshot of the error.

<wpv-loop></wpv-loop> it's necessary.

#1345051

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

I took a look at the site to try helping as best as possible.

However it seems that the issue has been resolved.

The archive page look exactly how you would want it.

Please let me know if everything is OK or if my help is still needed.
Thanks,
Shane

#1345195

Hi again Shane for your time. The issue it's not solved. There are a lot of duplicated records.

hidden link (servicios archive has a lot of duplicated records). It would be like as hidden link.

Do you see the difference?

#1345201

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

So I managed to solve the issue.

The correct format would be


[wpv-layout-start]
	[wpv-items-found]
[wpv-taxonomy-slug]
	<!-- wpv-loop-start -->
[wpv-view name="duplicate-a"]
	<wpv-loop wrap="1" pad="true">

	</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]

However I had to create a duplicate version of the view "Vista de tipologias" called Duplicate A. This is because there is a bug with views and the archive where if you add a view to an archive and it is using a content template then the results will show blank.

The solution is to add the loop output directly to the loop editor like this.

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop wrap="2" pad="true">
		[wpv-item index=1]
		<div class="row ">
			<div class="col-md-6"><h3>[wpv-taxonomy-link]</h3>
[wpv-view name="vista-de-servicios"]</div>
		[wpv-item index=other]
			<div class="col-md-6"><h3>[wpv-taxonomy-link]</h3>
[wpv-view name="vista-de-servicios"]</div>
		[wpv-item index=2]
			<div class="col-md-6"><h3>[wpv-taxonomy-link]</h3>
[wpv-view name="vista-de-servicios"]</div>
		</div>
		[wpv-item index=pad]
			<div class="col-md-6"></div>
		[wpv-item index=pad-last]
			<div class="col-md-6"></div>
		</div>
	</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]


So you issue should now be resolved as the view is no longer listing the duplicates.

Please let me know if this helps.

Thanks,
Shane

#1345997

Thanks a lot Shane. U're the master. Thanks again for your kindness , time and help.

#1345999

My issue is resolved now. Thank you!