Skip Navigation

[Resolved] Conditional Block (Template) – replace a post field with a custom field

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

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

Assisted by: Shane.

Author
Posts
#1719475

Hello,
I need to conditionally display (in Template) a custom field "rename-author" to REPLACE "author-posts-link", in case that "rename-author" exists. It means that a (WordPress) user will able to rename the content's author - if needed. I am using Block editor.

I was trying to follow this documentation: https://toolset.com/course-lesson/using-toolset-conditional-block/ but it seems to force me to work in the Advanced editor and it is too complicated for me here.

Many thanks for your help.
Jiri

#1719815

Shane
Supporter

Languages: English (English )

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

Hi Jiri,

Thank you for getting in touch.

Would you mind allowing me to have admin access to the template that you want to apply this to ?

Perhaps you may have enabled the advanced editor by accident.

The private fields have been enabled for your response.

Thanks,
Shane

#1720811

Shane
Supporter

Languages: English (English )

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

Screenshot 2020-07-28 at 10.41.50 AM.png

Hi Jiri,

I wasn't able to find the fields that you were talking about in your first post.

However the conditional block should still allow you to create the condition. See Screenshot

All you have to do is search for the correct field that you need and you should be able to add the conditional statement using the interface.

Thanks,
Shane

#1721015

Hi Shane,
sorry, the field's name is "Přejmenovat autora" with a "rename-author" slug - it is a part of "Photogallery fields" group, please see here hidden link .

OK, I understand the screen you sent (the beginning of declaring the post field), but I just don't know how to continue (how to use the conditional logic) to solve my problem.

Can you please send me a more descriptive screen or can you please look at my Template again?

Many thanks,
Jiri.

#1721059

Shane
Supporter

Languages: English (English )

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

screenshot2.png
screenshot1.png

Hi Jirik,

Let me see how I can help with these 2 screenshots.

In screenshot 1 I'm comparing 2 fields, i'm comparing your "Přejmenovat autora" field to see if it is equal to the Post Title. What this will do is display the contents that are in the conditional block if the values are equal.

In screenshot 2 you will see me checking if the "Přejmenovat autora" field is empty and display the contents of the conditional block. To negate the empty statement so it displays when the field is NOT empty you will need to ensure that you've activated the NOT toggle.

Please let me know if this helps.
Thanks,
Shane

#1721109

Hi Shane,
OK, I am going to try it, but I still don't understand if these 2 screenshots are 2 different conditional fields or if they are somehow related (two conditions in one conditional field).

Again: It is always going to be some author visible.
For example, John Smith is the author of the post (John Smith is a registered WP user).

1. IF John Smith is not going to use "Přejmenovat autora" (rename-author) field to rename (himself) for another name, THEN the visible content's author will stay as John Smith.

2. IF John Smith is going to use "Přejmenovat autora" (rename author) field to rename (himself) for Dan Daniels, THEN the visible content's author is Dan Daniels. Dan Daniels doesn't have to be a registered WP user.

I hope that you understand my explanation.
Many thanks again.
Jiri

#1721187

Shane
Supporter

Languages: English (English )

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

Hi Jirik,

OK, I am going to try it, but I still don't understand if these 2 screenshots are 2 different conditional fields or if they are somehow related (two conditions in one conditional field).

These are completely 2 different conditional block. This is just giving an example of 2 different conditions setup. Once you've setup the condition that you want you will just need to click the insert button then just add what you want to display based on the condition inside the conditional block.


1. IF John Smith is not going to use "Přejmenovat autora" (rename-author) field to rename (himself) for another name, THEN the visible content's author will stay as John Smith.

Ok so you essentially want to display the default Post Author name when there is no value provided for Přejmenovat autora

I went ahead and set this up for you. Have a look at the content template below and you can see exactly how i've setup the conditional.
hidden link

Please let me know if this helps.
Thanks,
Shane

#1721201

Hi Shane, great, it is working now and I understand it. Thank you!

In fact, I didn't know that I can, in the beginning, declare a conditional section, and then it is possible to place the related fields inside. Cool 🙂

Thanks again!
Jiri

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