WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] stuck on loop custom post_type (6 posts)

  1. Cammy_WP
    Member
    Posted 3 years ago #

    need help on the loop!

    <?php query_posts('post_type=my_custom_posttype&showposts=-1&order=ASC') ?>
    //all post are now displaying

    //the taxonomy name is my_taxo and all post have its own category, item-1, item-2 etc.

    //now i want to get from my_taxo each items and display its Name in ASC order (this is where i get stuck)

    <?php //display the item-"x" name ?> //(in ASC order)
    // then display all the post regarding this item"x"
    <?php the_title(); ?>
    <?php the_content();?>

    and loop to the next item-"2" etc.

    i am confused using
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?> incorrectly

    have no idea how i can construct this correcly.
    Anyone want to guide me in this please?

  2. alvaron
    Member
    Posted 3 years ago #

    Hi Cammy,

    I've wrote a post about something like that on my blog. Hope you find it useful.

    http://wpworks.wordpress.com/2011/02/15/wordpress-custom-post-types-registering-and-displaying-in-a-very-easy-way/

    Best Regards

  3. GRAQ
    Member
    Posted 3 years ago #

    Just in case!

    Cammy, alvaron's article is good. I believe 1) it is important that you have WP3.1 for their new CPT and CT wp_query support and 2) make sure query_var is true.

    Listening to some wordpress.tv presentations, this is the way that WP encourage use of the query object.

  4. Cammy_WP
    Member
    Posted 3 years ago #

    Thank you for the advices! got it working :)

  5. alvaron
    Member
    Posted 3 years ago #

    Hi there folks. I'm glad to help! Good to know it works for you, Cammy!

  6. alvaron
    Member
    Posted 3 years ago #

    Graq, thank you form the comment about my post!

Topic Closed

This topic has been closed to new replies.

About this Topic