Skip to content

Instantly share code, notes, and snippets.

@svenl77
Last active January 11, 2019 17:05
Show Gist options
  • Save svenl77/f4c742be63bd1c8dabe15191db5ac053 to your computer and use it in GitHub Desktop.
Save svenl77/f4c742be63bd1c8dabe15191db5ac053 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'gmw_pt_search_query_args', 'buddyforms_geowp_data', 10, 2 );
function buddyforms_geowp_data( $query_args, $form ) {
global $wp_querie;
// echo '<pre>';
// print_r($query_args);
// echo '</pre>';
//if( is_page('suche-nach-bauaufgabe')){
//}
global $wp_query, $baumensch_projecte_earch_query, $args_projekte;
//$post_ids = wp_list_pluck( $wp_query->posts, 'ID' );
if ( bp_is_profile_component() || bp_is_current_component( 'projekte' ) ) {
$member_user_id = bp_displayed_user_id();
$post_ids = array( 2271, 2255, 2274 );
$args = array(
'post_type' => 'projekte',
'posts_per_page' => - 1,
'author' => $member_user_id,
// 'meta_query' => array(
// array(
// 'key' => 'projekt',
// 'value' => array( get_the_ID() ),
// )
// )
);
$query_args = $args;
} else if ( is_home() || is_front_page() ) {
$args = array(
'post_type' => 'projekte',
'posts_per_page' => - 1,
// 'author' => $member_user_id,
// 'meta_query' => array(
// array(
// 'key' => 'projekt',
// 'value' => array( get_the_ID() ),
// )
// )
);
$query_args = $args;
} else if ( get_post_type() == 'projekte' ) {
$args = array(
'post_type' => 'projekte',
'posts_per_page' => - 1,
'author' => get_the_author_meta('ID'),
// 'meta_query' => array(
// array(
// 'key' => 'projekt',
// 'value' => array( get_the_ID() ),
// )
// )
);
$latest = new WP_Query($args);
$project_ids = wp_list_pluck( $latest->posts, 'ID' );
$args = array(
'post_type' => 'baupunkte',
'posts_per_page' => - 1,
'author' => get_the_author_meta('ID'),
// 'meta_query' => array(
// array(
// 'key' => 'projekt',
// 'value' => array( get_the_ID() ),
// )
// )
);
$latest = new WP_Query($args);
$project_ids = wp_list_pluck( $latest->posts, 'ID' );
echo '<pre>';
print_r($project_ids);
echo '</pre>';
$query_args['post__in'] = $project_ids ;
} else {
$query_args = $args_projekte;
}
return $query_args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment