Skip Navigation

[Resolved] The wordpress archive doesn't work properly

This support ticket is created 6 years, 1 month 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 – 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 replies, has 2 voices.

Last updated by Luo Yang 6 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1153252

I am trying to follow the ticket https://toolset.com/forums/topic/how-do-i-link-a-filtered-category-link-to-a-page-other-than-a-wp-archive/ in order to get a categories page and a sub-categories page and finally the post archive of a custom post type. I create the two views and the and I create the archive by the wordrpress archive link. I can see the archive when I click on the square with an arrow on the archive editing page but when I follow the link on the front, after click on a category I get a list of posts that has a different layout and fields than the custom post type archive that I'm editing.

What can I do?

Thanks in advance.

#1153612

Hello,

How do you setup the "arrow on the archive editing page"?
Is it an archive page link? is it linked to term's archive page outputted from shortcode [wpv-taxonomy-link]?

If it is, in the term's archive page, it will output all posts assigned to this term, can you check all these posts are assigned to the specific term?

In the taxonomy archive page, you can also create an Views wordpress archive, in this wordpress archive, section "Taxonomy Archives", find and enable the specific taxonomy name, click button "Edit", in the following dialog window, you can specific the custom post types you want to output, see our document:
https://toolset.com/documentation/user-guides/create-custom-taxonomies/#custom-taxonomy-archives

#1153760

Hello Luo,

Sorry, I haven't explain correctly. My english is not very good.

That I'm trying to get is:
1-A page with all categories of a custom post type
2-In every category a link that goes to a page that show all the sub-categories of that category
3-In every sub-category page a link that goes to a page that shows all the posts of this sub-category.

But there are some categories without sub-categories and in this case I would like to show the posts instead the sub-categories.

What is the way to get this behaviour?

I'm trying to link the sub-categories page from shortcode [wpv-taxonomy-link]. How have I to link it?

I try to insert a view of the sub-categories in de custom post type archive but I don't know how to link it from a category. Do you mean that the way to do it is to insert a view of the posts on the taxonomy archive?

Thanks in advance.

#1154395
top-level-terms.JPG
terms.JPG
posts.JPG

Thanks for the details, I think it is possible, but it is little complicated. It needs 3 taxonomy view + 1 post view.

Here is a demo site:
hidden link
username/password: xgren/111111

Here are the detail steps:
1) You will need a custom post type with a hierarchical taxonomy, in above demo, I am using wordpress built-in post type "Posts" and taxonomy "Categories" for example.

2) Setup posts with parent/child terms, see them here:
hidden link
see screenshot posts.JPG and terms.JPG

3) Create a taxonomy view "Top level terms",
hidden link

- query terms of taxonomy "Categories",

- filter by:
Select taxonomy terms whose parent is None.
it will display only the top level terms of "Categories",

- and in the view's loop, display a link to target page, pass URL parameter "terms-filter":

<a href="[wpv-post-url item="2990"]?terms-filter=[wpv-taxonomy-id]">[wpv-taxonomy-title]</a>

The number 2990 is the page ID of step 4)
See screenshot top-level-terms.JPG

- Put it into a page:
hidden link

4) Create a taxonomy view "Get term by URL parameter",
hidden link

- query terms of taxonomy "Categories",
- filter by:
Taxonomy term ID is set by the URL parameter "terms-filter"
It will be able to retrieve the specific term by URL parameter.
- and in the view's loop, display view's shortcode of step 5)

[wpv-view name="sub-level-term"]

- Put it into a page (ID 2990):
hidden link

5) ) Create a child taxonomy view "Sub level term"
hidden link

- query terms of taxonomy "Categories",

- filter by:
Select taxonomy terms whose parent is the value set by the parent view.
it will display terms depends on parent taxonomy view "Get term by URL parameter",

In the view's loop, display the term's link same as step 3) , if there isn't any term found, then display child post view "Posts of current term" of step 6), for example:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<ul class="wpv-loop js-wpv-loop">
		<wpv-loop>
			<li>
				<a href="[wpv-post-url item="2990"]?terms-filter=[wpv-taxonomy-id]">[wpv-taxonomy-title]</a>
			</li>
		</wpv-loop>
	</ul>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		[wpv-view name="posts-of-current-term"]
	[/wpv-no-items-found]
[wpv-layout-end]

6) Create a post view,
hidden link

- Query posts

- filter by:
Select posts with taxonomy:
Categories set by the parent Taxonomy View

- In the view's loop, display the post's information, for example:

[wpv-post-link]
[wpv-post-taxonomy type="category" format="name"]

For your reference.

#1158757

Perfect, it works fine!

I have just one question. Is possible to add some breadcrumbs or get the title of the selected category and subcategory in the different pages where there are the views?

Thanks!

#1159346

No, there isn't such a feature, since all data are displayed in the wordpress page, I don't think breadcrumbs will work in this case.

But you can try with WordPress taxonomy archive pages, use Views wordpress archive to format/style the taxonomy archive pages.
https://toolset.com/documentation/user-guides/designing-archive-pages-for-custom-taxonomy/

In the Views wordpress archive content display a taxonomy view:
- query their children terms, filter by:
Select taxonomy terms whose parent is the current taxonomy archive.
- and display the term's archive page link
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153464

In the taxonomy archive pages, the breadcrumbs will be able to work, but our discover-wp.com does not have breadcrumbs installed, if you need assistance to setup it, please create a new ticket and provide a test site, I can setup a demo for you. thanks