93ceb336 by Jeff Balicki

post_tag

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 97749bf4
...@@ -10,43 +10,105 @@ function add_attachment_mime_type( $attachment_id ){ ...@@ -10,43 +10,105 @@ function add_attachment_mime_type( $attachment_id ){
10 10
11 } 11 }
12 12
13 function wporg_custom_post_type() {
14 register_post_type('documents',
15 array(
16 'labels' => array(
17 'name' => __( 'Documents', 'textdomain' ),
18 'singular_name' => __( 'Documents', 'textdomain' ),
19 ),
20 'public' => true,
21 'has_archive' => true,
22 'rewrite' => array( 'slug' => 'documents' ), // my custom slug
23 )
24 );
25 }
26 //add_action('init', 'wporg_custom_post_type');
13 27
14 // function filter_function_name( $query_args, $sfid ) {
15 // global $searchandfilter;
16 // $sf_current_query = $searchandfilter->get(112)->current_query();
17 // $sf_current_query_array = $sf_current_query->get_array();
18 // error_log('get_array');
19 // error_log(print_r($sf_current_query->get_array(),true));
20
21 // if($sfid==102)
22 // {
23 // foreach($sf_current_query_array as $key => $item){
24 // $query_args[$key] = $item['active_terms'][0]['value'];
25 // $query_args['_sfm_file_type'] = 'pdf';
26
27 // }
28 // }
29 // error_log('query_args');
30 // error_log(print_r($query_args,true));
31 // return $query_args;
32 // }
33
34 // add_filter( 'sf_edit_query_args', 'filter_function_name', 20, 2 );
35
36
37
38 // function filter_function_url( $url, $sfid) {
39 // error_log('url');
40 // error_log(print_r($url,true));
41 // return $url;
42 // }
43 // add_filter( 'sf_results_url', 'filter_function_url', 10, 2 );
44
45
46 // function filter_function_object($input_object, $sfid)
47 // {
48 // error_log('input_object');
49 // error_log(print_r($input_object,true));
50 // return $input_object;
51 // }
52 // add_filter('sf_input_object_pre', 'filter_function_object', 10, 2);
...\ No newline at end of file ...\ No newline at end of file
28 function wptp_add_categories_to_attachments() {
29 register_taxonomy_for_object_type( 'category', 'attachment' );
30 // register_taxonomy_for_object_type( 'continent', 'attachment' );
31 // register_taxonomy_for_object_type( 'country', 'attachment' );
32 // register_taxonomy_for_object_type( 'region', 'attachment' );
33
34 }
35 //add_action( 'init' , 'wptp_add_categories_to_attachments' );
36
37 // apply tags to attachments
38 function wptp_add_tags_to_attachments() {
39 register_taxonomy_for_object_type( 'post_tag', 'attachment' );
40 }
41 add_action( 'init' , 'wptp_add_tags_to_attachments' );
42
43 // register new taxonomy which applies to attachments
44 function wptp_add_taxonomy() {
45 $labels = array(
46 'name' => 'Continent',
47 'singular_name' => 'Continent',
48 'search_items' => 'Search Continent',
49 'all_items' => 'All Continent',
50 'parent_item' => 'Parent Continent',
51 'parent_item_colon' => 'Parent Continent:',
52 'edit_item' => 'Edit Continent',
53 'update_item' => 'Update Continent',
54 'add_new_item' => 'Add New Continent',
55 'new_item_name' => 'New Continent Name',
56 'menu_name' => 'Continent',
57 );
58 $args = array(
59 'labels' => $labels,
60 'hierarchical' => true,
61 'query_var' => 'true',
62 'rewrite' => 'true',
63 'show_admin_column' => 'true',
64 );
65 register_taxonomy( 'continent',[ 'attachment','documents'], $args );
66
67
68 $labels = array(
69 'name' => 'Region',
70 'singular_name' => 'Region',
71 'search_items' => 'Search Region',
72 'all_items' => 'All Region',
73 'parent_item' => 'Parent Region',
74 'parent_item_colon' => 'Parent Region:',
75 'edit_item' => 'Edit Region',
76 'update_item' => 'Update Region',
77 'add_new_item' => 'Add New Region',
78 'new_item_name' => 'New Region Name',
79 'menu_name' => 'Region',
80 );
81 $args = array(
82 'labels' => $labels,
83 'hierarchical' => true,
84 'query_var' => 'true',
85 'rewrite' => 'true',
86 'show_admin_column' => 'true',
87 );
88
89 register_taxonomy( 'region',[ 'attachment','documents'], $args );
90
91 $labels = array(
92 'name' => 'Country',
93 'singular_name' => 'Country',
94 'search_items' => 'Search Country',
95 'all_items' => 'All Country',
96 'parent_item' => 'Parent Country',
97 'parent_item_colon' => 'Parent Country:',
98 'edit_item' => 'Edit Country',
99 'update_item' => 'Update Country',
100 'add_new_item' => 'Add New Country',
101 'new_item_name' => 'New Country Name',
102 'menu_name' => 'Country',
103 );
104 $args = array(
105 'labels' => $labels,
106 'hierarchical' => true,
107 'query_var' => 'true',
108 'rewrite' => 'true',
109 'show_admin_column' => 'true',
110 );
111 register_taxonomy( 'country',[ 'attachment','documents'], $args );
112
113 }
114 //add_action( 'init', 'wptp_add_taxonomy' , 0 );
...\ No newline at end of file ...\ No newline at end of file
......