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
183318cf
authored
2023-11-21 18:26:49 -0500
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
qa
Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent
56548f45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
57 deletions
wp-content/themes/msf-child/inc/rest.php
wp-content/themes/msf-child/inc/search-extras.php
wp-content/themes/msf-child/inc/rest.php
View file @
183318c
...
...
@@ -34,16 +34,20 @@ function pull_posts_for_post_list( $data ) {
$posts
=
get_posts
(
array
(
'category'
=>
$categories
,
'numberposts'
=>
$numberposts
,
'order'
=>
'DESC'
,
'suppress_filters'
=>
false
'suppress_filters'
=>
false
,
'orderby'
=>
'menu_order'
,
'order'
=>
'DESC'
)
);
}
else
{
$posts
=
get_posts
(
array
(
'numberposts'
=>
$numberposts
,
'order'
=>
'DESC'
,
'suppress_filters'
=>
false
,
'category_not_in'
=>
$exclude
,
'exclude'
=>
$exclude_posts
,
'exclude'
=>
$exclude_posts
,
'orderby'
=>
'menu_order'
,
'order'
=>
'DESC'
)
);
}
...
...
wp-content/themes/msf-child/inc/search-extras.php
View file @
183318c
...
...
@@ -10,66 +10,29 @@ function add_attachment_mime_type( $attachment_id ){
}
function
exclude_in_search_results
(
$query
)
{
if
(
$query
->
is_main_query
()
&&
$query
->
is_search
()
&&
!
is_admin
()
)
{
$query
->
set
(
'post_type'
,
array
(
'attachment'
,
'documents'
)
);
$query
->
set
(
'meta_query'
,
array
(
'relation'
=>
'OR'
,
array
(
'relation'
=>
'AND'
,
array
(
'key'
=>
'exclude_from_search'
,
'value'
=>
1
,
'compare'
=>
'!='
,
),
),
)
);
}
}
add_action
(
'pre_get_posts'
,
'exclude_in_search_results'
);
// if(get_locale() == 'fr_FR') {
// $query->set( 'meta_query', array (
// 'relation' => 'OR',
// array (
// 'relation' => 'AND',
// array(
// 'key' => 'wpml',
// 'value' => 'FR',
// 'compare' => '==',
// ),
// ),
// ) );
// }else{
// $query->set( 'meta_query', array (
// 'relation' => 'OR',
// array (
// 'relation' => 'AND',
// array(
// 'key' => 'wpml',
// 'value' => 'EN',
// 'compare' => '==',
// ),
// ),
// ) );
// }
// 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'
);
function
filter_query_args
(
$query_args
,
$sfid
)
{
$query_args
[
'posts_per_page'
]
=
-
1
;
$query_args
[
'orderby'
]
=
'relevance'
;
$query_args
[
'order'
]
=
'ASC'
;
error_log
(
print_r
(
$query_args
,
true
));
return
$query_args
;
}
add_filter
(
'sf_edit_query_args'
,
'filter_query_args'
,
99
,
2
);
function
relevant_search_result
(
$q
)
{
if
(
is_search
()
&&
is_main_query
()
)
$q
->
set
(
'orderby'
,
'relevance'
);
$q
->
set
(
'order'
,
'ASC'
);
}
add_action
(
'pre_get_posts'
,
'relevant_search_result'
);
add_action
(
'init'
,
'set_exclude_from_search'
);
function
set_exclude_from_search
()
...
...
@@ -139,4 +102,3 @@ function update_tax_counts()
}
}
...
...
Please
register
or
sign in
to post a comment