Skip Navigation

[Resolved] How to conditionaly display URL field in the Archive list

This thread is resolved. Here is a description of the problem and solution.

Problem:

Display taxonomy field in taxonomy archive page.

Solution:

It is possible with Term Field, for example:

https://toolset.com/forums/topic/how-to-conditionaly-display-url-field-in-the-archive-list/#post-1709731

Relevant Documentation:

https://toolset.com/documentation/customizing-sites-using-php/functions/#url

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

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 – 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 6 replies, has 2 voices.

Last updated by jiriK-2 3 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1709341

Hello,

here I have a "Casting list" WordPress archive with "Casting" Post Type videos: hidden link
So I already have "Casting" Post Type based on WP category. As you can see, "Kafe" is a Casting's category which contains fields: Number as Post Title, Name, Video, Download single video link.

What I need: I need to insert a new url field at the top of these video's list/archive with a link for downloading all the videos (WeTransfer link) from the same Casting category: hidden link

What I already did:

1. I made another Post Type "Download Videos" with the URL field "Download all videos".
2. I assigned "Casting" categories to the "Download Videos" Post Type: hidden link
So now I can select a "Casting" category for "Download Videos" Post Type.

What I need now:

1. I need ONE Casting category selection to be required. It means that you have to assign One category (ONLY) to the "Download all videos" Post Type. I was trying to do it with Relationships but I couldn't choose ONE to ONE relationship (ONE "Download Videos" to ONE Casting category) because there is no possibility for choosing a WP category type during the Relationship wizard's process.

2. Then I will need to conditionaly display "Download all videos" field at the top of the same category Archive list -as I already explained it at the beginning of my problem. This field is going to be visible if a) it exists and if b) it was assigned to the same Casting category.

_______________

I hope that you will understand my problems' details and you can show/explain me how to solve it. Maybe there is even easier way.

Many thanks for your help and your suggestion.

Best,
Jiri.

#1709731

Dear Jiri,

In your case, it is possible with Term Field, for example:
1) Dashboard-> Toolset-> Custom Fields-> Term fields,
Here you can setup custom "Download all videos" field in taxonomy "WP category"

2) Edit each term of "WP category", you can setup "Download all videos" field value

3) Edit WordPress Archive page of taxonomy "WP category", you can display the "Download all videos" field value value with shortcode:
[types termmeta="download-all-videos"][/types]

4) And you can display different results by checking above shortcode is empty, for example:

[wpv-conditional if=" ('[types termmeta="download-all-videos"][/types]' eq '')" ]
No download
[/wpv-conditional]
#1713647

Dear Luo,
many thanks for your explanation,
now I know how to deal with Terms fields and how to place them in Archive page. Great!

But I still need your help with a conditional placement of this field in this case:

1. I need to set a conditional rule for this:

Here you can download all videos: [types termmeta='download-all-videos'][/types]

It means that "Here you can download all videos: link" is going to be visible only if the link exists (it means if the user/editor placed the link in the Casting Category page.

2. I need to open this link in a new window (target="_blank").

Thanks again for your help.
Best,
Jiri.

#1713701

I'm trying to do it in this way:

[wpv-conditional if="( [types termmeta='download-all-videos'][/types] ne '' )"]
Here you can download all videos: [types termmeta='download-all-videos' target='_blank'][/types]
[/wpv-conditional]

but it is not working.
Thanks again for your help.
Best,
Jiri.

#1714309

It should be able to work, please provide a test site with the same problem, also point out the problem page URL and wordpress archive page URL, I can setup a demo for you. Private message box enabled.

#1718917

Thanks for the details, I have done below modifications in your website:
Edit WordPress archive "Casting - video list":
hidden link
in section "Loop Editor", change the shortcodes as below:

[wpv-conditional if="( '[types termmeta='stahnout-vsechna-videa' output="raw"][/types]' ne '' )"] 
 Here you can download all videos: [types termmeta='stahnout-vsechna-videa' target='_blank'][/types]
 [/wpv-conditional] 

Please test again, check if it is fixed, thanks

More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#url
‘raw’=Display raw data stored in DB. No other formatting attributes (e.g. custom separator) will be respected.

#1719409

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.