search-extras.php
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
add_action( 'add_attachment', 'add_attachment_mime_type' );
function add_attachment_mime_type( $attachment_id ){
$post = get_post( $attachment_id );
$post_mime_type = explode(".", $post->_wp_attached_file);
update_post_meta( $attachment_id, 'file_type', end($post_mime_type) );
}
// function filter_function_name( $query_args, $sfid ) {
// global $searchandfilter;
// $sf_current_query = $searchandfilter->get(112)->current_query();
// $sf_current_query_array = $sf_current_query->get_array();
// error_log('get_array');
// error_log(print_r($sf_current_query->get_array(),true));
// if($sfid==102)
// {
// foreach($sf_current_query_array as $key => $item){
// $query_args[$key] = $item['active_terms'][0]['value'];
// $query_args['_sfm_file_type'] = 'pdf';
// }
// }
// error_log('query_args');
// error_log(print_r($query_args,true));
// return $query_args;
// }
// add_filter( 'sf_edit_query_args', 'filter_function_name', 20, 2 );
// function filter_function_url( $url, $sfid) {
// error_log('url');
// error_log(print_r($url,true));
// return $url;
// }
// add_filter( 'sf_results_url', 'filter_function_url', 10, 2 );
// function filter_function_object($input_object, $sfid)
// {
// error_log('input_object');
// error_log(print_r($input_object,true));
// return $input_object;
// }
// add_filter('sf_input_object_pre', 'filter_function_object', 10, 2);