아래 코드를 Code Snippet > Add New 로 하여 <?php 바로 아래 줄에 삽입합니다.
if( function_exists('oxygen_vsb_register_condition') ) {
global $oxy_condition_operators;
oxygen_vsb_register_condition('Has Results', array('options'=>array('true', 'false'), 'custom'=>false), array('=='), 'search_has_results_callback', 'Search');
function search_has_results_callback($value, $operator) {
global $wp_query;
$posts_found = $wp_query->found_posts;
if( $value == "true" && $posts_found > 0) {
return true;
} else if( $value == "false" && $posts_found == 0 ) {
return true;
}
}
}
상기 코드를 생성하면, Condition에서 Search Result Condition을 적용할 수 있게 됨.