Skip Navigation

[Resolved] Displaying image only for custom term

This support ticket is created 5 years, 9 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by davidH-33 5 years, 9 months ago.

Assisted by: Nigel.

Author
Posts
#1209088
logo-media3.jpg
logo-media22.jpg
logo-media2.jpg
logo-media1.jpg

Tell us what you are trying to do?

I have database of movies and I need to display logo "EU MEDIA Programme" on the single page of each movie that has term "media" in custom taxonomy "Loga". I'm using View "Logo MEDIA" and I i'm trying to use Query Filter for this but it's not working for me.
The term "media" has been assigned to this movie A dychejte klidne (custom type Filmy): hidden link
However the MEDIA logo displays on all single pages of custom type Filmy - e.g. here: hidden link
Please see screenshot attached. I can provide you login details if help us to speed up the process.

I was trying also to use this tutorial (and I prefer to use this way using conditional instead of Query Filter if it's possible) but I wasn't able to make it work: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/displaying-taxonomies-conditionally/#specific

What is the link to your site?
hidden link
hidden link

#1209397

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2019-03-04 at 12.00.34.png

Hi there

I'm not sure how the documentation led you to using a View with Query Filters to add the image when posts have a particular taxonomy term assigned, although that link you shared has recently been rendered obsolete.

You need a conditional shortcode so that where you have a View that displays Films, in the output section it checks if the current Film being looped over has the media term (of the Loga taxonomy) and if so outputs the image.

The GUI for inserting conditional shortcodes was missing support for taxonomies until the very last update, where it was added (I've pointed out to the documentation team that page needs updating).

So, in the output section of your View where you insert the img for the logo, surround the img tag with a conditional shortcode.

Use the "conditional output" button to insert the shortcode. As you can see in my screenshot (I'm using a 'status' taxonomy) you can directly insert such checks, which will add markup something like this:

          [wpv-conditional if="( CONTAINS(#(status),'submitted') )"]
          <p>I could add my img tag here</p>
          [/wpv-conditional]
#1209413
media-3.png

Hi Nigel, I was trying to create the conditional output following your instructions but it's not working for me - please see screenshot with conditional output that has been added to loop item. Any chance to provide you login so you can check it from wp administration? Thank you.

#1209419

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Your screenshot shows you using a View "Logo MEDIA".

I'm expecting you to use the conditional in a View to display film posts (which use the taxonomy) not a View to display the taxonomy terms.

It looks like you are mixing two approaches.

Is there a reason your View displays the taxonomy terms rather than adding this conditional directly to a View to display the film posts?

#1209422

Thank you for your help. I tried to add the conditional directly to a view shortcode in Elementor single post template and it works fine. So my issue is resolved now. Thank you!