Skip Navigation

[Resolved] Shortcode in View, Custom field filter not work

This support ticket is created 3 years, 8 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
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: Africa/Casablanca (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by stephaneM-4 3 years, 8 months ago.

Assisted by: Jamal.

Author
Posts
#1687111
Capture.JPG

Hello,

I have a shortcode that displays the zip code :
[types field='code-postal] [/types]

On my view, this shortcode returns the value 06000 for example.

I need to create Custom field filter by zip code.
If i set 06000 with "Constant", it works perfectly.

But, I would like to filter the request according to the value of this shortcode automatically depending on the page.
But if I set the shortcode atribute, I get an error.

I tried with :
[types field='code-postal'][/types]
code-postal
[types field='code-postal']

I get the same error message :
Only lowercase letters and numbers allowed as shortcode attributes

How do I filter on what the shortcode [types field='code-postal'][/types] returns?

Thanks

#1687473

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

You are currently adding a whole shortcode instead of a shortcode attribute. For example, in the following shortcode:

[types field='code-postal'][/types]

field is the shortcode attribute, and 'code-postal' is the value passed to the shortcode attribute.

The attribute that you will enter in the filter, needs to be used in the view shortcode. Let's say, you name the attribute "support", you will pass data to it like this:

[wpv-view name="your-view-name-or-slug" support="value to pass to the view filter"]

Read more about passing arguments to a view in this article https://toolset.com/documentation/user-guides/views/passing-arguments-to-views/

I hope this helps. Let me know if you have any questions.

#1687561

Hello,

Thank you for your reply,
I can not do it...

I also see that you speak French.

Do you have the possibility of making a service against payment because I am a little in the urgency?

I have this problem to manage and I would also like to display the top closest cities on a city page.

Here is my skype: stephane.madaleno

It would be really great if I could give you admin access and pay you for setup.

Thank you

#1687585

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Thank you for the offer! I'll do my best to help you here within the support forum.

Allow me temporary access to your website, and explain as much as possible the details of what you would like to achieve.
- What post types, taxonomies, custom fields are involved.
- What page/URL are you working on?
- What views or content template you are working on?
- Any screenshots that would clarify would be helpful.

Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

If you need assistance from a developer, you may consider contacting one of our partners here https://toolset.com/contractors/

#1693157

Merci beaucoup pour l'aide

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