• I am trying to display a random grid of divs by posts, custom post type posts, and users. Right now I’m doing it like this:

    <?php
                get_template_part('loop-header');
                $custom_post_and_posts_query = new WP_Query(array(
                    'showposts'  => -1,
                    'orderby'    => 'rand',
                    'post_type'  => array('custom_post', 'post')
                ));
                ?>

    Then I use if/elseif to get a few different kinds of posts until I endif because I need to start another query — the WP_User_Query:

    $user_query = new WP_User_Query(array(
                    'meta_query' => array(
                        array(
                            'foo'     => 'foo'
                        ),
                    ),
                ));

    Then I do a foreach until I enforeach.

    Then… I get some tweets….

    I’d like to randomize this whole display, but I’m not sure how to do that efficiently and I can’t find much on the topic. Wish I could show code, but this is all local for now.

    Please let me know if you’ve tackled this before. Many thanks.

  • The topic ‘Can I combine a WP_Query and a WP_User_Query to randomize presentation?’ is closed to new replies.