Skip Navigation

[Resolved] Using Non-Types Custom Fields in a View's Query Filters

This support ticket is created 2 years, 12 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Luo Yang 2 years, 12 months ago.

Assisted by: Luo Yang.

Author
Posts
#2028963

I don't know how much support I'm gonna get for this, but I figured I'd try and at least ask. So I'm using GeoDirectory (hidden link) as a location directory management platform. This site was originally built with only GeoDirectory in mind, and I am now being tasked with incorporating Toolset components to help manage the archives and post views as Toolset gives us greater control over the look and structure of the loop output. That being the case, I've run into a snag with their custom fields. They don't store the data in the postmeta table, thereby keeping me from being able to use the "Hidden Custom Fields" setting in Toolset's settings.

Since their data is all in its own separate table (geodir_gd_place_detail), I was wondering if there was a way to get Toolset to recognize the table as post meta data for use in Views and Query Filters. While I'm pretty sure I can cook up my own shortcodes to pull the information I need from the database for use in the view output, I'm not sure how to filter the output based on their custom fields.

What is the link to your site?
hidden link

#2029329

Hello,

There isn't such kind of built-in feature within Toolset Blocks/Views plugins, since those values are saved in other custom database table "geodir_gd_place_detail", Toolset Plugins won't get the values from that database table.

You might consider custom codes, for example, use wpv_filter_query filter hook to apply custom query codes:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#2029917

Ok, thank you.

Would you be able to give an example that would show how retrieve data from a specific field using the wpv_filter_query hook? That'll at least get me started in the right direction.

#2030033
screenshot.jpg

I have started on a means to pull the data, but it seems the filter I'm injecting has no label. Do you know how to resolve this?

This is my code so far:

add_filter('wpv_filter_query', 'get_featured_status');
function get_featured_status() {
    global $wp_query;
    $postid = $wp_query->post->ID;
    $data = geodir_get_post_meta($postid, 'featured', true);
    //Output GeoDirectory Data
    return $data;
}
#2030505

As I mentioned above, Toolset Plugins won't get the values from that database table.

According to our support policy, we don't provide such kind of custom codes support:
https://toolset.com/toolset-support-policy/

You can also check it with our Toolset certified consultants:
https://toolset.com/contractors/

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