Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
MSF
/
msf-climate-hub
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
93ceb336
authored
2023-08-21 18:45:20 -0400
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
post_tag
Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent
97749bf4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
39 deletions
wp-content/themes/msf-child/inc/search-extras.php
wp-content/themes/msf-child/inc/search-extras.php
View file @
93ceb33
...
...
@@ -10,43 +10,105 @@ function add_attachment_mime_type( $attachment_id ){
}
function
wporg_custom_post_type
()
{
register_post_type
(
'documents'
,
array
(
'labels'
=>
array
(
'name'
=>
__
(
'Documents'
,
'textdomain'
),
'singular_name'
=>
__
(
'Documents'
,
'textdomain'
),
),
'public'
=>
true
,
'has_archive'
=>
true
,
'rewrite'
=>
array
(
'slug'
=>
'documents'
),
// my custom slug
)
);
}
//add_action('init', 'wporg_custom_post_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
);
\ No newline at end of file
function
wptp_add_categories_to_attachments
()
{
register_taxonomy_for_object_type
(
'category'
,
'attachment'
);
// register_taxonomy_for_object_type( 'continent', 'attachment' );
// register_taxonomy_for_object_type( 'country', 'attachment' );
// register_taxonomy_for_object_type( 'region', 'attachment' );
}
//add_action( 'init' , 'wptp_add_categories_to_attachments' );
// apply tags to attachments
function
wptp_add_tags_to_attachments
()
{
register_taxonomy_for_object_type
(
'post_tag'
,
'attachment'
);
}
add_action
(
'init'
,
'wptp_add_tags_to_attachments'
);
// register new taxonomy which applies to attachments
function
wptp_add_taxonomy
()
{
$labels
=
array
(
'name'
=>
'Continent'
,
'singular_name'
=>
'Continent'
,
'search_items'
=>
'Search Continent'
,
'all_items'
=>
'All Continent'
,
'parent_item'
=>
'Parent Continent'
,
'parent_item_colon'
=>
'Parent Continent:'
,
'edit_item'
=>
'Edit Continent'
,
'update_item'
=>
'Update Continent'
,
'add_new_item'
=>
'Add New Continent'
,
'new_item_name'
=>
'New Continent Name'
,
'menu_name'
=>
'Continent'
,
);
$args
=
array
(
'labels'
=>
$labels
,
'hierarchical'
=>
true
,
'query_var'
=>
'true'
,
'rewrite'
=>
'true'
,
'show_admin_column'
=>
'true'
,
);
register_taxonomy
(
'continent'
,[
'attachment'
,
'documents'
],
$args
);
$labels
=
array
(
'name'
=>
'Region'
,
'singular_name'
=>
'Region'
,
'search_items'
=>
'Search Region'
,
'all_items'
=>
'All Region'
,
'parent_item'
=>
'Parent Region'
,
'parent_item_colon'
=>
'Parent Region:'
,
'edit_item'
=>
'Edit Region'
,
'update_item'
=>
'Update Region'
,
'add_new_item'
=>
'Add New Region'
,
'new_item_name'
=>
'New Region Name'
,
'menu_name'
=>
'Region'
,
);
$args
=
array
(
'labels'
=>
$labels
,
'hierarchical'
=>
true
,
'query_var'
=>
'true'
,
'rewrite'
=>
'true'
,
'show_admin_column'
=>
'true'
,
);
register_taxonomy
(
'region'
,[
'attachment'
,
'documents'
],
$args
);
$labels
=
array
(
'name'
=>
'Country'
,
'singular_name'
=>
'Country'
,
'search_items'
=>
'Search Country'
,
'all_items'
=>
'All Country'
,
'parent_item'
=>
'Parent Country'
,
'parent_item_colon'
=>
'Parent Country:'
,
'edit_item'
=>
'Edit Country'
,
'update_item'
=>
'Update Country'
,
'add_new_item'
=>
'Add New Country'
,
'new_item_name'
=>
'New Country Name'
,
'menu_name'
=>
'Country'
,
);
$args
=
array
(
'labels'
=>
$labels
,
'hierarchical'
=>
true
,
'query_var'
=>
'true'
,
'rewrite'
=>
'true'
,
'show_admin_column'
=>
'true'
,
);
register_taxonomy
(
'country'
,[
'attachment'
,
'documents'
],
$args
);
}
//
add_action
(
'init'
,
'wptp_add_taxonomy'
,
0
);
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment