Hello,
I'm using Toolset for faculty and staff listings on a new academic website - hidden link (in development).
We have a People page on the site for all people associated with this centre (hidden link)
For some of the people pages, the "Areas of Research" section shows up at the bottom with words that describe the person's research (field slug: areas-of-research). For example, Jennifer Davis' listing works well: hidden link
But for staff who are not researchers, I wasn't able to make the "Areas of Research" title disappear. For example: hidden link Since the areas-of-research is blank for these staff members, the title should disappear too.
The conditional shortcode I used didn't seem to get rid of the title. Can you help?
cheers,
Jacob
Hi Jacob,
Thank you for contacting us and I'd be happy to assist.
You can wrap the heading and the shortcode for the "areas-of-research" field inside a conditional output so that they both show only if the field's value is not empty.
For example:
[wpv-conditional if="( NOT(empty($(areas-of-research))) )"]
<h2>Areas of Research</h2>
[types field='areas-of-research'][/types]
[/wpv-conditional]
Here is a guide on the topic of using the conditional output:
https://toolset.com/documentation/legacy-features/views-plugin/checking-fields-and-other-elements-for-emptynon-empty-values/
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Waqar,
Thanks for that suggestion. When I add these conditionals, they don't seem to work - instead the shortcodes appear in the listing.
For example, on this listing, you'll see the conditional shortcodes at the bottom and the "Areas of Research" title hasn't disappeared: hidden link
Is there something that is keeping these shortcodes from working?
cheers,
Jacob
Thanks for writing back.
It looks like the code was added in the text editor, in the "Visual" mode and not the "Text" mode.
Can you please make sure that the code has been added in the "Text" mode and that there are no extra spaces, lines, or characters within it?
( screenshot: hidden link )
In case the issue still persists, you're welcome to share temporary admin login details, in reply to this message.
Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.
Thank you for sharing the admin access.
During troubleshooting, I noticed that the conditional shortcode isn't working on your website, because the Toolset Blocks plugin isn't active.
To make this work, you can activate the Toolset Blocks plugin and it should work. If for some reason, you'd prefer not to activate the Toolset Blocks plugin, you can update the code in the template to:
<h2 style="sans-serif; color: #205184; font-size: 24px; font-weight: 400; margin-top: 0px; margin-bottom: 0px;">Areas of Research</h2>
<p id="areas-of-research">[types field='areas-of-research'][/types]</p>
And next in the template's javascript editor ( screenshot: hidden link ), include the following script, that hides the heading "Areas of Research", when the field's text is empty:
jQuery(document).ready(function($){
if ($('p#areas-of-research').is(':empty')) {
$('p#areas-of-research').parent('.fl-rich-text').hide();
}
});
My issue is resolved now. Thank you!