query_posts
I think you can do an array for post_type parameter 😉
I’ve looked around but not really been able to find anything. Basically I am going to load in x amount of posts and the x amount of a few different custom posts. Is it possible to set up these different amounts in an array?
Thanks
Dan
You can specify showposts but it worked for both custom post type you are showing. If you can create ONE loop you can specify each parameter ONCE. You can show 10 post from default post and custom post types.
Sorry i don’t really follow you.
in non-code terms i am trying to do the following:
loop = posts x10 , portfolio x4 , photos x5, links x5
show loop (random order)
{
if portfolio{ do x}
else if photos {do y}
etc
}
so i dont know if i am able to load in this kind of thing:
<?php $loop = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => 2, 'order' => 'ASC') ); ?>
into one big loop which outputs everything in a random order.
Dan
Ok so i kind of having it working using this code:
<?php
//first query
$favourite = get_posts(array(
'post_type' => 'favourite',
'post_status' => 'publish'
));
//second query
$portfolio = get_posts(array(
'post_type' => 'portfolio',
'post_status' => 'publish',
'posts_per_page' => 3
));
$mergedposts = array_merge( $favourite, $portfolio ); //combine queries
foreach( $mergedposts as $post ) {
query_posts( $post );
the_title();?> <br/>
<?php } ?>
the only thing i can’t figure out is how to display the $mergedposts randomly?
i tried making a new array for it but that didn’t work? Can’t think what else to do?
Thanks for any help
Dan