Hi there, on this page (enlace oculto) we have some conditional logic set up to display which therapies each therapist offers, within therapists-archive. The code is as follows:
[wpv-conditional if="( '[wpv-archive-title]' = 'Archives: Therapists' )"]
<p class="btn small">[types field='first-name'][/types] offers</p>
[wpv-view name="therapies-list-view"][/wpv-conditional]
[wpv-conditional if="( '[wpv-archive-title]' = 'Archives: Teachers' )"]
<p class="btn small">[types field='first-name'][/types] teaches</p>
[wpv-view name="classes-list-view"][/wpv-conditional]
This was working fine but has now stopped. We've tested wpv-archive-title and it matches both 'Archives: Therapists' and 'Archives: Teachers'. We can't figure out why this has stopped working.
Can you look into this please? Thanks.

Minesh
Colaborador
Idiomas:
Inglés (English )
Zona horaria:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Toolset use the WordPress function get_the_archive_title() to get the current archive title. The function get_the_archive_title() return the archive title name with span tag. For example: Archives: <span>Therapists</span>
That is the reason the conditional statement was broken.
To make conditional works, we will require to remove the span tag from the archive title returned from WordPress.
I've added the following shortcode to the "Custom Code" section offered by Toolset:
=> enlace oculto
function func_get_current_archive_title( $atts ) {
return trim(strip_tags(get_the_archive_title()));
}
add_shortcode( 'get-current-archive-title', 'func_get_current_archive_title' );
And I've used the above shortcode with the conditional statement as given under:
[wpv-conditional if="( '[get-current-archive-title]' eq 'Archives: Therapists' )"]
<p class="btn small">[types field='first-name'][/types] offers</p>
[wpv-view name="therapies-list-view"]
[/wpv-conditional]
[wpv-conditional if="( '[get-current-archive-title]' eq 'Archives: Teachers' )"]
<p class="btn small">[types field='first-name'][/types] teaches</p>
[wpv-view name="classes-list-view"]
[/wpv-conditional]
More info:
=> https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-shortcodes-in-conditions/#checking-custom-shortcodes
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/
Ok, I don't understand how it was working before and then stopped working when we didn't change anything. But my issue is resolved now, so thank you!