WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WP_Query Parameters Not Working? (3 posts)

  1. thejester12
    Member
    Posted 5 years ago #

    Howdy, I'm trying to get a really simple loop to work on this page of my website. It would basically just create the select box under "Find Designs with your favorite CMS" and autofill in all of the names I need. I've tried several methods of this after reading through The Codex Loop Page several times. But nothing seems to work.

    This should output all posts (not just limited to 10) in alphabetical order in a certain category. The category seems to be the only thing that works!

    Any help would be appreciated!

    <select name="cmsname">
    <?php $my_query = new WP_Query('orderby=title&order=asc&showposts=0&cat=3'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <option value="<?php meta('thecmstag'); ?>"><?php the_title(); ?></option>
    <?php endwhile; ?>
    </select>
  2. MichaelH
    Member
    Posted 5 years ago #

    Works okay (posts ordered by title) but I had to set showposts=-1. Also had to change meta('thecmstag'); to the_title(); as meta is an invalid function on my test blog.

  3. thejester12
    Member
    Posted 5 years ago #

    Thanks so much, I took your recommendation and used showposts=-1, that works great. I think I figured out that a plugin was getting in the way of displaying the posts alphabetically. I'll work on that later. I appreciate the help.

Topic Closed

This topic has been closed to new replies.

About this Topic