WordPress.org

Ready to get started?Download WordPress

Forums

List posts by Taxonomy (1 post)

  1. Rakesh Raja
    Member
    Posted 2 years ago #

    I need a little complex loop finished

    Here is the site I am working on.

    http://prothane.com/complete_kits.php. It has lots charts. To make things easier for admin, I need to find a solution so admin just enter data like post and charts become ready so thought to use custom post type, taxonomy.

    I made this page as custom post type "Total Kits" - "total-kits"

    The titles in red are Taxonomy

    and data under red titles are posts with custom fields - no title - no post content.. just custom fields will be listed

    So far I am able to get all things

    but just not getting posts listed under a taxonomy.. thing is that I need to list Taxonomy and posts underthat

    like "Import & Domestic Cars" is taxonomy and post under that should be like this

    Import & Domestic Cars
    >> post 1
    >> post 2

    taxonomies can be any number of ..

    Following is the code.. I am able to list taxonomies for this custom post type

    <?php $args = array( 'post_type' => 'total-kits', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    
    while ( $loop->have_posts() ) : $loop->the_post();
    $cat = get_the_term_list( $post->ID, 'totalkits_cat', '', ' ', '' );
    echo $cat .'<br />';
    
    endwhile; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic