Randomly placed sticky custom posts complemented by blog posts

This did it:

    $products = get_posts(array('post_type' => 'products'));
    $numbers = range(0, 8); 
    shuffle($numbers);

    $x = 0;
    foreach($products as $post) : setup_postdata($post);
        $product = new WP_Query(array('p'=>$post->ID,'post_type'=>'products'));
        if (!empty($product->posts)) array_splice($posts,$numbers[$x],0,$product->posts);
        $x++;
    endforeach;


    foreach($posts as $post) : setup_postdata($post);
    ...

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)