Hi @dinmix, sorry for the delay in response.
Our current documentation is currently a bit out of date, we’re working on making it compatible with the latest version of Directorist.
Field Keys are no longer available for mutation by default. If you want to be able to see it or modify it, kindly copy-paste the below code on your theme’s functions.php and you should be good to go:
add_filter('directorist_custom_field_meta_key_field_args', function ($args) {
$args['type'] = 'text';
return $args;
});
Regards,
Mahdi.
Thread Starter
dinmix
(@dinmix)
Thank you Mahdi.
This works perfectly. One last question, how can I display all the listings on a page using this key?
Best Regards
Din
Hi @dinmix,
Use this code on your theme’s functions.php,
add_filter('atbdp_all_listings_query_arguments', 'atbdp_listing_query_arguments_custom');
function atbdp_listing_query_arguments_custom($args)
{
if(is_page('page_id/page_slug')){ //page slug (as a string) or page id(as a integer)
$args['meta_query']['key-field'] = array (
'key' => '_key-field', //meta key for that field (must use underscore before the meta-key name)
'value' => 'value', //value that you want to compare against
'compare' => '=',
);
}
//e_var_dump( $args );
return $args;
}
Regards,
Mahdi.
Thread Starter
dinmix
(@dinmix)
Thank you Mahdi
I tried it but it doesn’t seem to show any listing. I have added the key-field and added the value based on the option value of the checkbox.
Would you guys provide paid support?
Hi @dinmix,
We don’t really provide any Paid Support. But if you need help with anything custom, you can always get in touch with our technical support here: https://directorist.com/contact, we’ll help you as much as we can.
Regards,
Mahdi.