Navigation überspringen

[Gelöst] Display a view only if a specific term has posts

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

I wonder how to Display a view only if a specific term has posts ?

Solution:

I suggest you try with a taxonomy view, for example:

https://toolset.com/forums/topic/display-a-view-only-if-a-specific-term-has-posts/#post-1294449

Relevant Documentation:

https://developer.wordpress.org/reference/classes/wp_term_query/__construct/

This support ticket is created vor 5 Jahren, 7 Monaten. 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)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von romanB-3 vor 5 Jahren, 7 Monaten.

Assistiert von: Luo Yang.

Author
Artikel
#1294073

Hello,
I wonder how to Display a view only if a specific term has posts ?
Thank you.

#1294449

Hello,

I suggest you try with a taxonomy view:
- Query terms of your taxonomy
- in section "Query Options", enable option "Don't show empty terms"
- filter by:
Taxonomy is One of these: your specific terms
- in section "Loop Editor", within shortcodes [wpv-items-found] ... [/wpv-items-found]
display your what you want(other view shortcode ... etc)

More help:
https://developer.wordpress.org/reference/classes/wp_term_query/__construct/
'hide_empty'
(bool|int) Whether to hide terms not assigned to any posts. Accepts 1|true or 0|false. Default 1|true.

https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-items-found
Meta HTML wrapped in [wpv-items-found][/wpv-items-found] will be output if there are any posts | taxonomies | users returned by the View.

#1294821

My issue is resolved now. Thank you!
Just great, thank you.