This hooks allows to make compatible a filters plugins with TABLEON.
Lets review filter adaptation for MDTF (as an example ONLY because Compatibility for MDTF (redirect mode) in-built into the TABLEON code).
- into the file functions.php of the current WordPress theme add next code:
- 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869add_filter("tableon_profile_extend", function($profile, $action, $shortcode_args) {if ('tableon_default_tables' === $action) {if (isset($shortcode_args['filter_provider'])) {if ($shortcode_args['filter_provider'] === 'mdtf') {if (isset($_REQUEST['page_mdf']) AND!empty($_REQUEST['page_mdf'])) {$profile[0]['filter_provider'] = 'mdtf';$_GLOBALS['MDF_META_DATA_FILTER'] = json_decode(base64_decode($_REQUEST['page_mdf']), true);$_REQUEST['mdf_do_not_render_shortcode_tpl'] = true;$_REQUEST['mdf_get_query_args_only'] = true;do_shortcode('[meta_data_filter_results]');$args = $_REQUEST['meta_data_filter_args'];$args['posts_per_page'] = -1;$args['fields'] = 'ids';if (isset($args['meta_query'])) {if (!empty($args['meta_query'])) {foreach ($args['meta_query'] as $key => $m) {if (isset($m['key'])) {if ($m['key'] === 'mdf_hide_post') {unset($args['meta_query'][$key]);}}}}}if (isset($args['ignore_sticky_posts'])) {unset($args['ignore_sticky_posts']);}unset($args['orderby']);unset($args['order']);//***$profile[0]['filter_data'] = [];$profile[0]['filter_data']['ids'] = (new WP_Query($args))->posts;}//***add_action('tableon_filter_provider_mdtf', function ($args, $filter_data) {if (!is_array($filter_data)) {$filter_data = json_decode($filter_data, true);}if (isset($filter_data['post_title']) AND!empty($filter_data['post_title'])) {tableon()->filter->provider($filter_data);}if (!empty($filter_data['ids'])) {$args['post__in'] = $filter_data['ids'];} else {//$args['post__in'] = [-1];}return $args;}, 10, 2);}}}return $profile;}, 10, 3);