Skip Navigation

[Resolved] Conditional views displaying out of order

This support ticket is created 3 years, 3 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 – 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)

This topic contains 17 replies, has 3 voices.

Last updated by jennZ 3 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#2146825

I'm trying to figure out why my nested conditional views are displaying out of order on hidden link. It's supposed to show the listings with the Verified taxonomy first, then those with the Featured taxonomy (though I'm still adding those in, so there aren't any at the moment), then those with the Free taxonomy. I have it set to order it by post date, but it's mixing the taxonomies all together (though it is formatting them correctly, which is a win!) rather than keeping them separate and in order, which is how I thought it would show up based on how I have the view loop containers nested.

I'm guessing I'm missing something, but I'm not sure what. Can anyone point me in the right direction? Thanks!

#2147041

Shane
Supporter

Languages: English (English )

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

Hi Jen,

Thank you for getting in touch. If I understand correctly you have 3 different types of posts marked by the Taxonomies and you want to display them separately on the same page correct?

If so then you will perhaps need to employ the use of 3 different taxonomies and use static taxonomy query filters to filter each view for the correct type of post that you want to display by the view.

This is the only way you can have the posts grouped as you're not able to sort the view by a taxonomy term.

Please let me know if this points you in the right direction.
Thanks,
Shane

#2147169

No, I think I explained it poorly. I have a single post type (Speaker Profile) with its own taxonomy (Speaker Level). I have a View set up with search options and then the view outputs. I've nested containers inside of conditional blocks in order to only display Speaker Profiles that have a certain Speaker Level assigned, as each level is formatted differently. If I nest a View inside of the main View, will the search filters still work on it? (Sorry, I'm still new to how Toolset works, so trying to figure all of this out.) Thanks!

#2149953

Shane
Supporter

Languages: English (English )

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

Hi Jenn,

If I nest a View inside of the main View, will the search filters still work on it?

The view will only filter correctly if you add the correct query filters to the nested views. Given that you're nesting your views i'm assuming that you're using the classic views editor. If so then you will need to go to the query filter section of the view and add the corresponding query filter and set it to be filtered by the URL parameter.

From there you just need to ensure that the URL parameters corresponds to the one that is being passed by your main view's frontend filter.

Please let me know if this helps.
Thanks,
Shane

#2155749

Reply from additional thread: https://toolset.com/forums/topic/conditional-views-displaying-out-of-order-trying-this-again/
---
I somehow missed the notification about the last reply to my previous thread on this issue (https://toolset.com/forums/topic/conditional-views-displaying-out-of-order/) and it was closed on a weekend before I was back into my business email inbox, so I wasn't able to re-open it.

In response to the last reply from Shane, no, I'm not using classic views. I'm not nesting views; as I explained previously, I've nested containers inside of conditional blocks in order to only display Speaker Profiles that have a certain Speaker Level assigned, as each level is formatted differently. It's all within a SINGLE View.

Essentially, all I need is a way to sort the posts within that [single] View by Taxonomy, THEN by created date. There doesn't seem to be a way to sort by the taxonomy, though, unless I'm missing something.

#2156265

Shane
Supporter

Languages: English (English )

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

Hi Jenn,

Actually no there isn't a way to sort the view created by blocks using taxonomies.

However it is possible to do with the Classic view editor. This will involve that you create 2 views and nest them together.

The first view will essentially be a taxonomy view and the second view will be listing your posts. The Taxonomy view allows you to sort the view by the taxonomy name and when you nest the child view i.e the post view into the taxonomy view you will get the posts listed based on the taxonomy views order.

You can then further sort your post view by the date field.

The exact documentation for this would be
https://toolset.com/documentation/legacy-features/views-plugin/using-a-child-view-in-a-taxonomy-view-layout/#taxonomy-view-with-a-post-view-for-a-child

However to get access to the classic view editor you will need to enable it by going to Toolset -> Settings and scrolling down to Editing Experience.

Once you're here select the 3rd option as this should give you access to both the Classic and Block edit. Finally just refresh the page after it has been save and you will now have access to Toolset -> Views.

Please let me know if this helps or if there are any further queries on this.

Thanks,
Shane

#2157045

I have the legacy views enabled, but they're an awful editing experience (I understand why the upgrade was made!). If there was a way to duplicate my current view as legacy views for the taxonomies, that would be viable, but if I have to recreate all four views separately, I think I'll lose my mind. It was already enough of a pain trying to create the accordion view in the legacy editor as recommended in another of my support threads. I don't even know if I'd be able to get it to look the same in the legacy view, based on my current experience.

Or are you saying it's possible to create the legacy view for the taxonomy view and then nest the regular view I've already created into that one? I just want to make sure I'm understanding correctly. Thanks!

#2157159

Shane
Supporter

Languages: English (English )

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

Hi Jen,

Or are you saying it's possible to create the legacy view for the taxonomy view and then nest the regular view I've already created into that one? I just want to make sure I'm understanding correctly. Thanks!

That is correct even if your post view was created purely in blocks, the only way to nest them is by adding that view into the classic view.

You can't nest the views using the block editor.

So create the taxonomy view as a classic editor view and just nest the post view into it using the instructions in the tutorial above.

If you're unsure of any steps please don't hesitate to reach out.

Thanks,
Shane

#2157787

Alright, trying to reply for the third time. Hopefully this one goes through...

I've tried nesting the legacy views, but it's not working correctly. I can't seem to include multiple legacy post views inside the legacy taxonomy view without it crashing. The tutorial isn't very enlightening and the example sites in it are defunct and thus not helpful for troubleshooting. I feel like I'm missing something, but I'm not sure what.

In case it helps, the test page I created to preview the nested legacy view is at hidden link, though I don't know if it will load for you; it doesn't seem to be working for me.

#2158483

Shane
Supporter

Languages: English (English )

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

Hi Jenn,

Thank you for the example link.

Not sure why you're nesting a search view into your other views as the parent views won't have any effect on the search view at all.
hidden link

This view only has filters to make it work for the search fields.

The problem that comes up is that you want to display based on speaker levels, however the speaker level is a frontend filter. It also not advised to nest the search view into another view.

Nested views work best with static display of content where the content being displayed is determined by the parent view.

Thanks,
Shane

#2158787

Because I don't fully know what I'm doing with Toolset and I was trying to follow the guidance you gave, but I seem to have misunderstood it. I duplicated the view in question and removed the search portion, but it's still not working. I'm sorry if I'm being obtuse; it's just not clicking for me where I'm missing something...

#2158895

Shane
Supporter

Languages: English (English )

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

Hi Jenn,

I see the issue now, you were double adding the views for speakers profile. Now the view should've been added here.
hidden link

As you can see i've made some adjustments and the view should now be displaying on the page. However as you can see the items are not displaying in a Grid.

I would recommend only nesting classic views, so you should remake this view that is displaying the speakers in the classic view in order to get the columns to work correct.

Please let me know if this helps.
Thanks,
Shane

#2159051

Okay, I've finally got it displaying almost correctly on hidden link. I was able to recreate the views in new classic views by making the styled containers from the original view as reusable blocks and adding them to the classic views.

In the nested taxonomy view, though, it repeats all of the taxonomies three times and the columns are not even (which seems to be messing with the button sizing and cutting off text, as well) and I'm trying to figure out why. I've played with the loop code and can't find anything. I did remove the "no items found" section from the individual views because I don't need that for them and it was creating even more repeats, but that's all I've been able to find. It's SO close to being right!

I'm also unclear on how to still get a search function with this setup. Since the taxonomy view can't have search inputs and I don't want search inputs for each individual view, will I need to create another searchable view and nest the taxonomy view inside of that one now?

#2159901

Shane
Supporter

Languages: English (English )

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

Screenshot 2021-09-03 at 9.59.17 AM.png

Hi Jen,

I checked your views, though you are getting an output you're not doing it correctly.

When you nest your views the idea is that it will list out the posts like this.

-Tax A
--Post A
--Post B
-Tax B
--Post C
--Post D

In your case you've nested the views but you're adding static filters to each of your child views which aren't dependent on the parent taxonomy view. Essentially having a parent view is useless if the filter is static. See the screenshot.

When a view is nested the parent view is used to determine what the child view will display. You don't need to create several different views for each of your posts with the selected term as these terms are being listed out by the parent view and telling the child view what to display.

If you check on the view now you will notice that i've removed 3 other views and added the [wpv-taxonomy-title] shortcode so that you can see what i'm referring to a bit clearer.

Given that only 1 view is required, you simply need to go to your certified speaker view and re-add the conditionals so that the color of the speaker card changes based on their taxonomy.
hidden link

This is the exact same as when you've set this up with your search view.

I'm also unclear on how to still get a search function with this setup.

As mentioned previously nested views operate under the assumption that you won't be performing any searches on the speakers so It is not recommended that searches be added to nested views.

If you really want to search and have the list prefiltered then a nested view approach wouldn't be correct. The correct approach would have different pages for each of your different views that would be prefiltered and then add the search to each.

Please let me know if this helps.
Thanks,
Shane

#2160369

If you really want to search and have the list prefiltered then a nested view approach wouldn't be correct. The correct approach would have different pages for each of your different views that would be prefiltered and then add the search to each.

I don't need it pre-filtered, just sorted. However, what I'm understanding is that I cannot actually create a directory that functions like this: hidden link
Is that correct? If so, then I've wasted all this time when Toolset won't actually do what I need it to. I need it to display the Speaker Profiles sorted by Speaker Level AND to be searchable, all in one page. Each Level has different block formatting, so I've tried to explain this numerous times and I've poured hours into this.

I got around part of the issue by also making the Speaker Levels a custom field and keeping all of the different Levels on the same view, but I have to be able to use search filters for all of the Speaker Levels at once or the entire exercise is pointless. I have to imagine there's a way to do this...