Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress 3.1 | Display Custom Post Types data BY Custom Taxonomy

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31948

    Hi!

    I’m new to PHP and WordPress 3.1 Custom Post Types and Taxonomies. I’ve created the title so others can easily find this solution later.

    For a client, I have made my own custom post types with their own custom taxonomies in functions.php.

    Now I want to use the single.php to grab the Custom Field $key by $value, if it exists. If that $value is “youth”, I want to pass that value into a function that will query my site for the custom taxonomy that I made and if it finds data, it will show that data. The data that’s in the custom post type. I want to display that custom post type’s excerpt() and title().

    This is an author’s site. The single.php displays a book and information related to it. At the bottom, I want to pull in reviews based on which custom taxonomy they are a part of (these taxonomies are tied to the custom post types). So if the book is about youths, I want to pull my reviews organized by the custom taxonomy, youths.

    I feel I’ve tried all that I could find to implement, but I haven’t gotten over the learning curve enough to understand why it doesn’t work, so I’m not able to fix it.

    Thank you so much for your help.
    Daniel

    #55960

    Well, several hours later, I solved my own problem. Place this code outside the main loop.


    ID, $key, true) ); { ?>
    'child-custom-taxonomy', 'showposts' => 3 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post(); ?>


    Latest Reviews




    ';
    endwhile; ?>

    #149580
    Kennedy Otis
    Participant

    Hi danielbrinneman

    Actually am looking for something close to what you have just said. Am new to wordpress and am making a wordpress which involves products. I have created a custom post type for the products and added 3 custom taxonomies to the product post type. My aim is to have a product to belong to product_category,product_brand and product_type. Then I would like to have a query which will return the products with their respective category, brand and type. Is that really possible? If so I will really appreciate your help. Here is my functions file (http://codepad.org/opDNhZPf)

    Thanking you in advance as am waiting to hear from you

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.