EVENTI COLLEGATI:
					
																																	
									
									
									
									
									
																			
									
									
																							
									
									
									
									
									
										 
									
									
									
													
										
					
                   
				
				 
									function add_admin_menu_separator($position) {
  global $menu;
  $index = 0;
  foreach($menu as $offset => $section) {
    if (substr($section[2],0,9)=='separator')
      $index++;
    if ($offset>=$position) {
      $menu[$position] = array('','read',"separator{$index}",'','wp-menu-separator');
      break;
    }
  }
  ksort( $menu );
}
function my_acf_google_map_api( $api ){
	
	$api['key'] = 'AIzaSyC4IEuWDihtCI6OT1T4R0PyI54p4cQEAbE';
	
	return $api;
	
}
add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
add_filter( 'post_thumbnail_html', 'post_thumbnail_default', 10, 3 );
function post_thumbnail_default( $html, $post_id, $post_image_id ) {
	if( '' == $html ) {
		$html = ' . '/images/default.jpg' . ') ';
	}	
		
	return $html;
}
function my_pre_get_posts( $query ) {
	
	// do not modify queries in the admin
	if( is_admin() ) {
		
		return $query;
		
	}
	
	
	// only modify queries for 'event' post type
	if( isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'evento' ) {
		
		// allow the url to alter the query
		if( isset($_GET['data_di_evento']) ) {
			
    		$query->set('meta_key', 'data_di_evento');
			$query->set('meta_value', $_GET['data_di_evento']);
			
    	} 
		
	}
	
	
	// return
	return $query;
}
add_action('pre_get_posts', 'my_pre_get_posts');
/*
	 *  Remove Google Maps API Call if used in Enfold theme and Auto Location is active
	 */
		add_filter( 'avf_load_google_map_api', '__return_false' );
?>
';
	}	
		
	return $html;
}
function my_pre_get_posts( $query ) {
	
	// do not modify queries in the admin
	if( is_admin() ) {
		
		return $query;
		
	}
	
	
	// only modify queries for 'event' post type
	if( isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'evento' ) {
		
		// allow the url to alter the query
		if( isset($_GET['data_di_evento']) ) {
			
    		$query->set('meta_key', 'data_di_evento');
			$query->set('meta_value', $_GET['data_di_evento']);
			
    	} 
		
	}
	
	
	// return
	return $query;
}
add_action('pre_get_posts', 'my_pre_get_posts');
/*
	 *  Remove Google Maps API Call if used in Enfold theme and Auto Location is active
	 */
		add_filter( 'avf_load_google_map_api', '__return_false' );
?>