Forum Replies Created
-
AuthorPosts
-
erikleirdal
ParticipantB2BKing replied. I have not tested the Free version of you so I dont know if that works. But this is their code,
add_filter(‘asl_query_args’, array($this, ‘asl_query_args_postin’), 10, 1);
function asl_query_args_postin($args) {
$args[‘post_in’] = is_array($args[‘post_in’]) ? $args[‘post_in’] : array();
if (!defined(‘ICL_LANGUAGE_NAME_EN’)){
$allTheIDs = get_transient(‘b2bking_user_’.get_current_user_id().’_ajax_visibility’);
} else {
$allTheIDs = get_transient(‘b2bking_user_’.get_current_user_id().’_ajax_visibility’.ICL_LANGUAGE_NAME_EN);
}
$allTheIDs = apply_filters(‘b2bking_ids_post_in_visibility’, $allTheIDs);
$currentval = $args[‘post_in’];
if (!empty($currentval) && $allTheIDs !== false){
$allTheIDs = array_intersect($allTheIDs, $currentval);
}if ($allTheIDs){
if(!empty($allTheIDs)){
$args[‘post_in’] = array_merge($args[‘post_in’], $allTheIDs);
}
}
return $args;
}erikleirdal
ParticipantThanks. I’ll take your answer to B2BKing 🙂
erikleirdal
ParticipantI found this online, from the request from B2BKing themself. But adding this to code snippets doesnt seem to do the trick. Hidden products still show up in Ajax Search.
add_filter(‘asl_query_args’, ‘asl_query_args_postin’, 10, 1);
function asl_query_args_postin($args) {
$args[‘post_in’] = is_array($args[‘post_in’]) ? $args[‘post_in’] : array();
$args[‘post_in’] = array_merge($args[‘post_in’], array(1,2,3));
return $args;
} -
AuthorPosts