Skip Navigation

[Resolved] Split: Filtering a view from a field – conditionally display the view based on town

This support ticket is created 4 years, 10 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by ericK-4 4 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#1538653

Hi Minesh,
Thanks it works ! Last question if I want to put a message if there's no town availalble, can I make a conditionnal statement on the view itself ?

#1538659

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

What section do you want to display conditionally?

Do you mean that if the Ville field value is empty, you do not want to display the section "Some advocate in the same town"?

#1538699

Hi Mineh !
Yes, just for informing the visitor of the site with a sentence like :
“Not another advocate available in “name of the town”
Eric

#1538705

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As the field ville is belonged to repeating field group and we are checking if [types field='ville'][/types] is empty, we can not display the name of the ville as the value is not available, its empty.

So, we can add the conditional statements as given under to the following view.
=> hidden link


   <h1>Some advocate in the same town </h1>
  [wpv-conditional if="( '[types field='ville'][/types]' eq '' )"]
      Not another advocate available
  [/wpv-conditional]
  
  [wpv-conditional if="( '[types field='ville'][/types]' ne '' )"]
      [wpv-view name="avocat-same-ville" currentcity="[types field='ville'][/types]"]
  [/wpv-conditional]
#1538801

My issue is resolved now. Thank you!