After a few months of working after hours I finish my advertised service. At last I met a surprise ...
The taxonomy filter can not be used in the archive.
Is there a way to get around this?
I will be grateful for the help or some hint.
Dear Bochnacki,
Where and how do you see the problem:
The taxonomy filter can not be used in the archive.
As I know, there does exists a limitation within Views plugin:
When it is a taxonomy wordpress archive, for example "my-tax", the taxonomy filer won't be able to work, you should be able to see the warning message:
This filter will not be applied to Taxonomy Archives matching the filtered taxonomies: my-tax
This is expected result, for example, you are in the term "term1" archive page:
hidden link
It should not display the other term's posts
So the taxonomy filter won't be able to work in the taxonomy archive page.
As a work around, I suggest you try create a view display the term archive page links, for example:
Create a taxonomy view, list terms of the custom taxonomy, display the term's archive page link with shortcode [wpv-taxonomy-link]:
https://toolset.com/documentation/views-shortcodes/#wpv-taxonomy-link
Put the above taxonomy view into the taxonomy wordpress archive, users click those links, they will be redirected to corresponding term's archive page.
The problem is that I have to have on every page (neutral whether it is a category view, or is a category archive) brand-model-version filter. So that the user can quickly choose another brand or model.
For example, being on hidden link
It can quickly select in the BMW-> Serie 3-> E36 filter.
Now this filter I have made (not quite yet) using JavaScript. For example, the category "Osobowe" is a hirerarchical taxonomy and is inserted into the filtrate as:
[wpv-control taxonomy="osobowe" url_param="wpv-osobowe" type="checkbox" format="%%NAME%% (%%COUNT%%)"]
I think how to solve the problem.
1. I found such a topic https://toolset.com/forums/topic/filtering-product-from-within-the-archive-page/#post-395292 which seems to me a solution, but I do not fully understand the described process and operation.
2. Will the solution of the problem be to change the hierarchical taxonomy into two parent-child relationships? So instead of the hierarchical taxonomy of setting up CPT "Cars-Brand", "Cars-model" and "Cars-version"?
Q1) I found such a topic...
It is not recommended to use the workaround mentioned by Nigel, if you are using a normal view to replace wordpress archive, it will conduct a lots of problems, for example:
AJAX pagination and AJAX filter of normal normal view do not work as expected in the archive page
Q2) Will the solution of the problem be to change the hierarchical taxonomy into two parent-child relationships...
In your case, It is not recommended to use parent-child relationships to replace the hierarchical taxonomy, it make things complicated.
As the workaround I provided above:
You just need to provide links for user to redirect to the target term's archive page, then they will be able to setup other filters manually.
"You just need to provide links for user to redirect to the target term's archive page, then they will be able to setup other filters manually." - I do not understand...
You can expand your mind, or give an example?
Yes, I have already provide you the example with detail steps here:
https://toolset.com/forums/topic/taxonomy-filter-in-archive/#post-552889
As a work around...
Please check it, thanks
I did as you did.
I made a view for taxonomy "Osobowe". In the "Loop Output Editor" I inserted [wpv-taxonomy-link].
The result is a list of links: hidden link
It does not give me anything, I do not expect it. The archive look should be the same as the category look: hidden link
And the problem with taxonomy filter still is (it's about the drop-down "Marka", "Model" and "Wersja"at the top of the filter section).
Or something I did wrong because I misunderstood you, or that's not the point 🙁
I assume we are talking about the problem page:
hidden link
and the taxonomy view "Osobowe - taxonomy":
hidden link
The shortcode [wpv-taxonomy-link] does output the correct term archive page links in front-end, you can compare the links with links in admin side:
hidden link
in each term, there is a link "view", there you will be able to see the term archive page URLs.
The URL you mentioned above:
hidden link
This is a single post of custom post type "ogloszenia", you can edit it here
hidden link
It is not a taxonomy archive page.
Please confirm it, thanks
It's like you write.
"The URL you mentioned above:
hidden link
This is a single post of custom post type "ogloszenia", you can edit it here
hidden link
It is not a taxonomy archive page." - exactly.
This page uses a view hidden link
So the problem is different from the original question of this thread:
https://toolset.com/forums/topic/taxonomy-filter-in-archive/#post-552797
The taxonomy filter can not be used in the archive.
Since it is in a single post, you can create a normal view with taxonomy filter, and put it into the single post, the taxonomy filter should work without any problem. could you confirm it first?
If it is, the workaround I provided is not needed any more for this thread.
Sorry, but I do not understand what you're writing about.
What does "single post" to my problem? I do not understand.
I do not know English well, maybe I wrote something wrong and I do not understand, so I'm attaching a screen with my problem.
If you need to link to the single post of custom post type "ogloszenia" (hidden link), then what you need is a post view:
1) This view query the posts of custom post type "ogloszenia",
2) you can display the links with Views shortcode [wpv-post-link]
I don't think there is any relationship with your original question:
The taxonomy filter can not be used in the archive.
It does not need any taxonomy filter in this case.
Unless there still are some misunderstands.
Yes, we still do not understand 🙂
My problem is that the taxonomy filter can not work in the archive.
My question is - what can I do to avoid this problem?
How do I rebuild the page structure? Or how else do you make a Brand-> Model search filter?
Maybe this filrt can somehow "paste" from another page on the archive page? ...
Or can do that as shown on screen "taxonomy-search.jpg"?
It will be inserted outside the archive view. Filter targeting other archive pages, such as "Personal> Skoda> Octavia> v.III".
I do not know if it makes sense and I do not know how to do it ... What do you think about it?
Q1) My question is - what can I do to avoid this problem?
I have already provided you a workaround without changing the structure:
https://toolset.com/forums/topic/taxonomy-filter-in-archive/#post-552889
As a work around, I suggest you try create a view display the term archive page links, for example:
Create a taxonomy view, list terms of the custom taxonomy, display the term's archive page link with shortcode [wpv-taxonomy-link]:
https://toolset.com/documentation/views-shortcodes/#wpv-taxonomy-link
Put the above taxonomy view into the taxonomy wordpress archive, users click those links, they will be redirected to corresponding term's archive page.
Q2) How do I rebuild the page structure? Or how else do you make a Brand-> Model search filter?
And I have answered your question here:
https://toolset.com/forums/topic/taxonomy-filter-in-archive/#post-552921
In your case, It is not recommended to rebuild the page structure, I don't suggest use parent-child relationships to replace the hierarchical taxonomy, it make things complicated, but it still depends on yourself.
If you insist on using parent-child relationships filter, please check our document to setup the parameter search form and filter:
Building Custom Searches for Any Content Type
https://toolset.com/documentation/user-guides/front-page-filters/#wpv-control-set-item
There are some shortcodes you might use:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-post-relationship
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-item
This shortcode is a wrapper for the [wpv-control-post-ancestor] shortcodes generated when displaying a custom search that uses a filter by post relationship.
This shortcode displays each ancestor input for a custom search that uses a filter by post relationship.
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-set
This shortcode is a wrapper for the [wpv-control-item] shortcodes generated when displaying a custom search that uses a filter by post relationship.
And in my opinion, the new question is a problem about parent/child post type filter, which is different from original question of this thread.
Hope it is clear.