• I’m very new to WordPress so I may have my terms mixed up. I’ve registered a custom post type called exhibitors. Within that CPT I have many taxomonies set up (categories).

    I have custom template to display the CPT and I’m stuck on the query. So far, I can get all the exhibitors and display them.

    new WP_Query( array( ‘post_type’ => ‘exhibitors’, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 20 ) );

    How do I get at the taxomonies? What I’m looking for is something like this:
    EXHIBITORS:

    Bakers
    -joes bakery
    -sallys cupcakes

    Flower Shops
    -jims roses
    -peters pedals

    To display I’m using a loop in Geneses:

    function exhibitor_loop() {

    $loop = new WP_Query( array( ‘post_type’ => ‘exhibitors’, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 20 ) ); ?>

    <div id=”allexhibitors”>

    <h1><?php the_title(); ?></h1>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    ” ><?php the_title(); ?></br>

    <?php endwhile;?>
    </div><!–end #exhibitors –>
    <?php
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Query to display data from cutom post type’ is closed to new replies.