[wp-hackers] how to query all posts from post type and some posts from another post type?
Jackson Whelan
jw at jacksonwhelan.com
Mon May 7 14:47:15 UTC 2012
You can use an array for the post_type parameter in WP_Query, ie:
$query = new WP_Query( array( 'post_type' => array( 'post',
'fdp-post' ) ) );
http://codex.wordpress.org/Class_Reference/WP_Query#Type_.26_Status_Parameters
- Jackson
On 5/7/12 10:23 AM, Steve Taylor wrote:
> My suspicion is this won't be possible with a single WP_Query. You may
> have to do two, concatenate the resulting arrays, and maybe re-sort
> using something like usort().
>
>
> On 7 May 2012 11:53, Konrad Karpieszuk<kkarpieszuk at gmail.com> wrote:
>> hello
>>
>> I have to query posts (jn main loop) from two post types:
>> - 'post' (regular post type from wordpress) but only those, which have
>> 'fdp' category
>> - 'fdp-post' (post type created by me) with any category
>>
>> and i really dont know how to do this :) both conditions should
>> produce on list of posts arranged by date
>>
>> --
>> (en) regards / (pl) pozdrawiam
>> Konrad Karpieszuk
>> http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
>> klientów z Polski
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list