Skip Navigation

[Resolved] query filter by shortcode attribute

This thread is resolved. Here is a description of the problem and solution.

Problem:

The user wanted to filter their view by using a shortcode attribute.

Solution:

This can be done by adding your query filter then set it to by a shortcode attribute.

Give this attribute a name and then you can call your view shortcode with that attribute.

Example if you gave the attribute a name called "date" then you would call it like this.
[wpv-view name='my-view' date='shortcode for date']

This support ticket is created 5 years, 11 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 – 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 8 replies, has 3 voices.

Last updated by sathishkumarG 5 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#1189752
Screenshot 2019-01-23 at 15.28.35.png

Tell us what you are trying to do?
display a list of posts with the same field value as the current post
Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#1189788

Shane
Supporter

Languages: English (English )

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

Dave,

Could you provide the credentials for the site as well as a link to where you are working on this.

Thanks,
Shane

#1189831

Shane
Supporter

Languages: English (English )

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

Hi Dave,

Should be working now.

What I did was to set the DATE attribute on the filter to a number then change the shortcode being passed to [types field='date-of-birth' output='raw']

This way it outputs the timestamp that is saved in the Database.

Thanks,
Shane

#1189839

ok.. thanks Shane.
so for all date field comparisons, i should use number, and use raw output when calling the fx.

thank you for your help today.

#1189844

what should i do if i want to output the oldest fella based on date of birth? is it even possible?

#1189879

please disregard the last question. I think I figured out the way to do it.
much thanks Shane.

#1189942

Shane
Supporter

Languages: English (English )

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

Hi Dave,

Happy I was able to assist.

You can mark this ticket as resolved once you're ready.
Thanks,
Shane

#1189943

My issue is resolved now. Thank you!

#1328049
Screenshot from 2019-08-30 16-33-12.png

Hi Support,

I hava a problem with shortcode attribute, how can i display as a widget?
i have attached the screenshot of my shortcode and placed it.

Thanks