Skip Navigation

[Resolved] View to drilldown into taxonomy and finally go to search result page

This support ticket is created 6 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.

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 15 replies, has 3 voices.

Last updated by DianneB565 6 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#943794

Hello, I have a taxonomy with 3 levels of terms. There are around 24 parents which each have a bunch of children. Each child again has a bunch of children.

On one page I now want to show a view which only shows the parents. When I click on one of them, I want to only show the children of that parent. When I then click on a children there, I want to show the children of that child. Finally, when I click on the child in the third level, I want to go to another page where I display all posts of that term in a list.

How can I have such a drill down and can it be done in a way that it works if I have varying number of levels. Lets say one parent only has only one level of children and another one has four levels. Everytime I click on a child-term which has no more children itself, I want to then display a list of posts.

#948283

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - to display the hierarchical taxonomy terms and at last the posts belongs to that taxonomy term, you need to following the following steps:

1)
Create a taxonomy view for your taxonomy. Name this view as "top-category-view"
=> Uncheck the checkbox "Don't show empty terms" at section "Query Options"
=> Add following code to it's loop output section [You can add fields as you wanted to loop output]:

<wpv-loop>
<a href="?taxonomy_id=[wpv-taxonomy-id]" target="_self" >
        <h3 class="image-link-text">[wpv-taxonomy-title]</h3>
</a>  
 </wpv-loop>

2)
Add following code to your current theme's functions.php file:

add_filter( 'wpv_filter_taxonomy_query', 'func_filter_by_parent', 99, 4 );
function func_filter_by_parent($tax_query_settings, $view_settings, $view_id) {
	if($view_id == 9999){
		(!isset($_GET['taxonomy_id']))? $tax_query_settings['child_of']=0:$tax_query_settings['child_of'] = $_GET['taxonomy_id'];
	}
    return $tax_query_settings;
}

Where:
- Replace 9999 with your taxonomy view ID

add_filter( 'wpv_filter_taxonomy_post_query', 'prefix_check_items', 20, 4 );
function prefix_check_items( $items, $tax_query_settings, $view_settings, $view_id ) {
	if($view_id == 9999){
		
		foreach( $items as $item ) {
			$children = get_term_children( $item->term_id, 'product_cat');
			
			if(count($children)==0){
				$display_posts =$_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST']."/posts-list/";
				$item->name = '<a href="'.$display_posts .'?wpvproductcat='.$item->slug.'" target="_self" >'.$item->name.'</a>';
			}else{
				$item->name = '<a href="?taxonomy_id='.$item->term_id.'" target="_self" >'.$item->name.'</a>';
			}	
		}
    }
    return $items;
}

Where:
- Replace 9999 with your original taxonomy view ID

3)
Create a new View to list ALL posts belongs to the lower most taxonomy term, Lets say "view-posts-belongs-to-term"
=> Add new query filter for taxonomy as given under and save it, For instance my taxonomy is "Product Categories"

Select posts with taxonomy: Product Categories slug in one of those set by the URL parameter wpvproductcat
eg. <em><u>hidden link</u></em> 

=> add fields to display your post information as required at "loop output" section, for example [wpv-post-title] etc..etc..

4)
Create a new page namely "Posts List" and add view "view-posts-belongs-to-term" created at step #4

5)
Create a new page and add "top-category-view" view to list categories and it should work as per your need when you click on the taxonomy term link.

Could you please try above steps and try to resolve your issue.

#948722

I followed your steps, create the page, created the view, added the code to the function.php and it displayed a solid white page. In fact the page was broken..had to trash it.

The biggest issue that I am having is that I am a process person. I follow a step by step approach. When a step is overlooked or you assume that I should know something - then things get lost in the translation.

Obviously you are a coder. You are the total opposite from me. I am a developer...and since the recent tools are GUI, I have left the coding days behind...but I started coding in HTML and ASP more than 15 years ago. I seriously don't remember this stuff.

What do you suggest?

#948765

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I need access details and I will try to build solution for you on your install.

Please tell me which post type posts you want to display with the lowest child taxonomy term and which taxonomy you want to display.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#950079

Hello,

Minesh is not available, he is on vacation until next Monday, please let me know if you still need to discuss with him.

And we don't provide support on phone call.

#950199

I do need to accomplish the tasks described. I do trust you as you wrote the tool. Let me set up the FTP and WordPress accounts.

#950210

Yes, I can take care this thread.

I have checked your original question:
https://toolset.com/forums/topic/view-to-drilldown-into-taxonomy-and-finally-go-to-search-result-page/#post-943794

In my option, you just need two views:
1) Taxonomy view, query the child terms of current parent term, in the views loop, in Views loop, display links to pass term's slug as URL parameter

2) Post view, query posts of your custom post type, filter by the URL parameter of term's slug
and display the posts

Display both above views in same page.

If you need assistance for it, please provide a test site with same problem, I can setup a demo for you.

#950235

I just purchased agency licensing to create a Dev environment. I have created a Toolset account using your purchases@toolset.com email address. I will set up an FTP Account as well.

I do not see the Option to provide a password in a private message.

#950254

I have enabled the "private message box", please provide your website credentials in it, thanks

#950258

Referral List Sitemap (page name) in question. Two view should be in a Bootstrap grid - 4 columns including counts.

A Drop-down for Taxonomy Level 1, Level 2, Level 3, Country, State, City, Zip.

The Referral List is using the main Ad Categories Taxonomy. Level 3 should list businesses (Level 4).

View of Businesses in a "Referral List Business Table".

#950268

Sorry, I don't see the your private message box and credentials, do you need assistance to find the "private message box" ?and I have to enable "private message box" again, please provide your website credentials in it, you can also edit this one:
https://toolset.com/forums/topic/view-to-drilldown-into-taxonomy-and-finally-go-to-search-result-page/#post-949379

The email "purchases@toolset.com" is our email for handling purchase issues. it is not for technique support

And I am off, will check it in tomorrow morning, my time zone is GMT + 8

#951108

Thanks for the details, I can login your website, will update this thread if there is anything found

#951255

I have done below modification in your website:
1) Edit the taxonomy view "Ad Subcategory"
hidden link
in section "Query Filter", change the filter as below:
Select taxonomy terms whose parent is the current taxonomy archive.

2) Edit the taxonomy view "Ad Sub-Subcategory"
hidden link
in section "Query Filter", change the filter as below:
Select taxonomy terms whose parent is the value set by the parent view.

You can test the result in front-end, for example:
hidden link

You will be able to see the sub terms and related posts.

There are new lots of question in this thread, we can handle them one by one.

Q1 )Is it best to use the Bootstrap Grid - 4 columns?
That depends on yourself, you can setup it as what you want, here is a document about
https://toolset.com/documentation/user-guides/view-layouts-101/
Views Output Formats – Bootstrap, Table, Grid, Ordered and Un-Ordered Lists

Q2) Can I add a white textured background image to the taxonomy display pages with Divi?

This is a DIVI question, it should be able to achieve with a little CSS codes. for example:
hidden link

Q3) Sitemap (for entire site): hidden link
I assume we are talking about the taxonomy view "Ad Cat Sitemap-No Image"
hidden link
1) it is a taxonomy view, it does not custom search form, so it is not possible to setup a search form as you mentioned above:
SEARCH at the top for TYPE Section (different Sections), Countries, States, Zip, Level 1, Level 2, Level 3 dropdowns.
2) Even in post form, it does not setup the dropdowns by taxonomy field, it only support the post type relationship, see our demo site:
hidden link
section "Search Houses", the dropdowns "State" and "City", it is based on post type relationships:
State-> City -> Property

You can setup your own demo site here and check the settings
https://discover-wp.com/site-templates/

Q4) VIEW: for Businesses at Level 4
I think in your case, you just need to customize the wordpress archive page of taxonomy "Ad Categories":
hidden link

Here is a document about:
WordPress Archive – Customizing the Appearance of Archive Pages
https://toolset.com/documentation/user-guides/normal-vs-archive-views/

Please create new thread for the new questions, that will help other users to find the answers. thanks

#951321
Level 3 issue - wrong display.jpg
Level 3 issue - correct display..jpg
Level 2 issues.jpg

I think I just broke everything in Referral List. How could I have done this? Nothing is showing up on the Dashboard. All that I saw below is gone.....

There are no Referral List Businesses showing up in level 4:
hidden link

See attached picture.

Issue 1: Notice Restaurant Equipment is not aligned properly. There is a big gap on the pages.
Issue 2: Don't want a dropdown listing for Level 2, need to remove boxes.
It is better to display Level 2 Restaurant Food with (??) count. Restaurant Food Category is Linked to Level 3.

Issue 3: The current display is another level display...which is too deep. This level should display the businesses.
Included wrong Level3 and expected level 3.
There are no Referral List Businesses showing up in level 4: There are no Referral List Businesses showing up in level 4:
hidden link

I have read, re-read and tried everything...what am I doing wrong?

#952044

Q1) Issue 1: Notice Restaurant Equipment is not aligned properly. There is a big gap on the pages.

Where and how can I see the problem: a big gap on the pages
Please point out the problem page URLs

Q2) Don't want a dropdown listing for Level 2, need to remove boxes.
I have tried it in your website, open level 1 page:
hidden link
click an image, and it redirect me to level 2 page, for example:
hidden link
There isn't dropdown listing, please describe detail steps to see the problem

Q3) The current display is another level display...which is too deep. This level should display the businesses.

Same as above, please describe detail steps, how and where I can see the problem, thanks