0

I have a WP_Query like this.

    <?php
        $quote_args = array(
            'post_type' => 'post',
            'category_name' => 'quote',
            'orderby' => 'rand',
            'posts_per_page' => 1
        );

        $quote  = new WP_Query($quote_args);

        if($quote->have_posts()):
            while($quote->have_posts()):
                $quote->the_post();
    ?>
    <div id="testimonialWrap">  
        <p class="testimonial">
            <?php the_content_rss(); ?>
            <span><?php echo the_title(); ?></span>
            <em></em>
        </p>
    </div>
    <?php
        endwhile;
        endif;
    ?>

It just randomly selects posts that are quotes.

My questions is the $quote_args array has a group of key / value pairs: ('post_type' => 'post')

Is there a list of the keys that can be used here. Is there a name for these key / value pairs.

1 Answer 1

2

Is there a list of the keys that can be used here. Is there a name for these key / value pairs.

The "list" is in the Codex on the WP_Query page or you can just check the source.

I don't know what kind of "name" you are looking for. Other that "key/value" I'd call them "arguments" or "parameters" (as does the Codex). I really don't understand that part of the question.

2
  • I was going to call them arguments - this is what I was looking for. billerickson.net/code/wp_query-arguments Commented Aug 8, 2013 at 14:58
  • 2
    The WP_Query link provided by s_ha_dum's answer has more people looking at it and keeping it updated than Bill's code. Bill's a great person, but ... Commented Aug 8, 2013 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.