183318cf by Jeff Balicki

qa

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 56548f45
......@@ -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'
) );
}
......
......@@ -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()
}
}
......