Skip Navigation

[Resolved] Conditional block is missing post taxonomy field

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

This topic contains 8 replies, has 2 voices.

Last updated by corneliaS 3 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#2402073
Bildschirmfoto 2022-06-21 um 16.52.46.png

Tell us what you are trying to do?
I am trying to display custom content on the WooCommerce My Account page and display it conditionally, it should display only posts from a certain post category.

Is there any documentation that you are following?
Yes this one: https://toolset.com/course-lesson/using-toolset-conditional-block/
But I only get as far as setting the source "Post Taxonomies" and under field all I get is "Translation Priorities", not the actual post taxonomy.

Is there a similar example that we can see?
No but I'll attach a screenshot.

What is the link to your site?
hidden link

#2402103

Shane
Supporter

Languages: English (English )

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

Hi Cornelia,

Thank you for getting in touch.

Based on my understanding you're trying to display a list of posts but only want posts from a specific category to be displayed?

Can you let me know if you're using a view block to display the post listing.

Thanks,
Shane

#2402273
Bildschirmfoto 2022-06-21 um 19.44.54.png

Hi Shane,

thank you for getting back to me.

I did not get as far as adding a view block, right now I'm stuck on the settings of the conditions block. I know how I can accomplish what I want in theory (and have done so in the past) but for some reason I'm not seeing my taxonomy field (normal WP categories, not even a custom taxonomy) but only a field "translation priorities" (you can see it in the screenshot I have added).

I'm using WPML so don't know if this is causing the issue. I tried disabling WPML to see if it is making any difference and then I can't even set "Post Taxonomies" as the source, it's not there.

Both Toolset and WPML are up to date but maybe I'm missing something else.

Thank you,
Cornelia

#2402315

Shane
Supporter

Languages: English (English )

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

Hi Cornelia,

For me to understand correctly I need to understand your query.

Based on what I've gathered from your post you want to filter a list of Posts from Post Type A based on a Taxonomy Term ?

Please let me know if this is correct.

Thanks,
Shane

#2402325

Hi Shane,

yes it's pretty much that. I want to display content and/or one or more posts (regular WP posts, not a custom post type) based on a taxonomy term. The reason is that we have different membership levels assigned to taxonomy terms.
For example, member level A can see posts from taxonomy terms A, B and C. Member level B can see posts from taxonomy terms B and C and member level C can only see posts from taxonomy level C.

I have one post from taxonomy term B that should be displayed on the My Account page and visible only to members from level A and B and completely hidden from level C and anybody else. So my idea was to use a conditional block and put it in there but that is where I got stuck.

I hope I explained it well enough.

Thank you,
Cornelia

#2402327

Shane
Supporter

Languages: English (English )

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

HI Cornelia,

If that is so then you can make use of the Query Filter in our View Block.

You won't need to use the conditional block to filter out the posts. If you use the query filter on the view block it will automatically pull only the posts from your specific taxonomy.

So in your View block on the right hand side, highlight the custom search section and you should see the section for the query filter. Use this to add the Taxonomy query filter and from there you can select which taxonomy you want to filter the view by.

Please let me know if this helps.
Thanks,
Shane

#2402715
Bildschirmfoto 2022-06-22 um 12.38.58.png

Hi Shane,

using the query filter on the view is only partially solving my problem. It does hide the post content but the title and no access message are still visible to anyone (see attached screenshot).

Ideally nothing at all would be displayed for visitors without the proper rights, that's why I thought I'd wrap this particular content in a conditional block.

The query filter in the view does give me 3 taxonomies to choose from, as it should: categories, tags and translation priorities. The conditional block however only shows me the latter and neither categories nor tags, that's where I am stuck.

Thank you,
Cornelia

#2402811

Shane
Supporter

Languages: English (English )

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

Hi Cornelia,

In this case you wouldn't be checking against the taxonomy for the conditional block.

You would be checking against the user role. So you would create the conditional for the current user's role instead of the post taxonomy. Then you would add your view inside that conditional block.

Thanks,
Shane

#2402997

Hi Shane,

thank you, I think I understand now. I have been playing with it a bit more and found a way to assign specific user roles by purchasing a product (= membership A, B or C) and therefore the conditional block with checking against the user role works well.

Thank you,
Cornelia