A very common WordPress function to modify the posts that are fetched on a page is called query_posts(). There are two ways to pass parameters to query_posts; you can pass an array or you can use the concatenated version. To display multiple post types on a page, the easiest way to do that is to pass parameters as an array argument to query_posts, like so:
$args = aray( 'post_type' => array ( 'post', 'page','event') ); query_posts($args);
In some case you may want to use the concatenated version instead, for example because you are fetching posts using Ajax and are using GET variables. This is pretty straightforward if you are querying a single post type:
query_posts('post_type=event');
The question is, how do you query multiple post types? Looking at the WordPress codex, it doesn’t quite tell you how this works for post types. You could try similar examples for querying multiple category ids or tags, like this:
// like multiple category ids: doesn't work query_posts('post_type=post,page,event'); // like multiple tags: also doesn't work query_posts('post_type=post+page+event');
But you’ll quickly find neither of these examples work. I was about to give up and just use a serialized array for my use case, when I tried another simpler method for passing an array via a GET string:
query_posts('post_type[]=post&post_type[]=page&post_type[]=event');
Lo and behold, it works! In hindsight, this is a common way of passing arrays via a GET string, it just didn’t occur to me as an option because it wasn’t in the Codex.
If you have multiple post types on your WordPress site you can try it quickly by entering this as the url: ‘http://yoursite.com/?post_type[]=post&post_type[]=page’.