Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

we have set up a custom post type under the heading of custom post type along w/two custom taxonomies. (the following code has been added to our functions.php page:) add_action('init', 'create_seminar_post_type');

function create_seminar_post_type(){ register_post_type('seminars',

        array(
                'labels'=> array(
                        'name' => 'Seminars',
                        'singular_name' => 'Seminar',
                        'add_new' => 'Add New Seminar',
                        'add_new_item' => 'Add New Seminar',
                        'edit' => 'Edit Seminars',
                        'edit_item' => 'Edit Seminar',
                        'new_item' => 'New Seminar',
                        'view' => 'View Seminar',
                        'view_item' => 'View Seminar',
                        'search_items' => 'Search Seminars',
                        'not_found' => 'No Seminars found',
                        'not_found_in_trash' => 'No Seminars found in Trash',
                        'parent' => 'Parent Seminar',
                ),
                'supports' => array('title', 'editor', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'thumbnail', 'author', 'page-attributes'),
                'public' =>true,
                'taxonomies' => array('post_tag', 'category')
                )
    );
    register_taxonomy ('trt', 'seminars', array(
    'labels' =>array(
                'name' =>'Total Running Time',
                'singular_name' => 'Total Running Time',
                'search_items' => 'Search Total Running Time',
                'popular_items' => 'Popular Total Running Times',
                'all_items' => 'All Running Times',
                'parent_item' => 'Parent Running Time',
                'edit_item' => 'Edit Running Time',
                'update_item' => 'Update Running Time',
                'add_new_item' => 'Add New Running Time',
                'new_item_name' => 'New Running Time Name'
    ),
                'hierarchical' => true, 'label' => 'Total Running Time'));
    register_taxonomy ('discs-in-set', 'seminars', array(
    'labels' =>array(
                'name' =>'# of Discs in Set',
                'singular_name' => 'Total Discs in Set',
                'search_items' => 'Search Discs in Set',
                'popular_items' => 'Popular Discs in Set',
                'all_items' => 'All Discs in Set',
                'parent_item' => 'Parent Discs in Set',
                'edit_item' => 'Edit Discs in Set',
                'update_item' => 'Update Discs in Set',
                'add_new_item' => 'Add New Discs in Set',
                'new_item_name' => 'New Discs in Set'
    ),
    'hierarchical' => false,
    'public' => true,
    'show_ui' => true,
    'query_var' => 'discs-in-set',
    'show_tagcloud' => true,
    ));

}

and here's the code added w/the loop in our single-seminar page (derived from the single.php page):

<?php $loop = new WP_Query( array( 'post_type' => 'seminars', 'posts_per_page' => 10 ) ); ?>
        <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
        <?php the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>' ); ?>

what we'd like to have shown for each individual seminar is the seminar info, along w/the custom taxonomy info of running time and discs in set. But all that shows is the seminar post and its accompanying categories & tags. what should I do to make this work?

on a similar note, when viewing the seminars listing in the dashboard, it shows all the listings , with columns for title, author, categories, tags, comments and date. It would be nice to incorporate the custom taxonomies into this listing for the sake of simplicity. Can this be done w/custom taxonomies? Or is there a more direct mode in doing this? any help/insights are greatly appreciated..

  • don
share|improve this question
    
I've noticed that you've asked 8 questions but your accept rate is 0%. You might find people more interested in answering your questions if you actively reward them by selecting a best answer and up-voting all good answers on your questions. Also, you've asked two (2) questions here; you really should ask a second question with an appropriate title for that question instead of grouping both questions on one question title. –  MikeSchinkel Mar 28 '11 at 10:26
    
thanks for the insight - I didn't know the etiquette. But since you brought it up , how do I up-vote an answer? I don't see this as a link . . . –  don de lion Mar 29 '11 at 5:55
    
That's okay, as a moderator it's my job to help new users learn how things work around here. We were all newbies once. You'll need 15 reputation before you can up-vote; I've up-voted two of your questions so now you can. And please remember to select the best answer for each of your questions; click the checkmark next to the vote count number on the left of the answer for the answer you like the best. –  MikeSchinkel Mar 29 '11 at 7:11

1 Answer 1

up vote 3 down vote accepted

For the dashboard post listing bit....

http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column

    // ADDS EXTRA INFO TO ADMIN MENU FOR PRODUCT POST TYPE
add_filter("manage_edit-ve_products_columns", "voodoo_prod_edit_columns");
add_action("manage_posts_custom_column", "voodoo_prod_custom_columns");

function voodoo_prod_edit_columns( $columns ) {

    // Add the extra column for product categories instead of rebuilding the whole array
    $columns['prod_cat'] = "Product Category";
    $columns['description'] = "Excerpt";

    return $columns;
}

function voodoo_prod_custom_columns( $column ) {
    global $post;
    switch( $column ) {
        case "description":
            the_excerpt();
        break;
        case "prod_cat":
            echo get_the_term_list( $post->ID, 'product_category', '', ', ', '' );
        break;
    }
}

I use this to add in 2 columns to my ve_products custom post type. the description column displays the excerpt, the prod_cat displays my custom taxonomy (product_category). Getting rid of:

$columns['description'] = "Excerpt";

Would kill the excerpt portion and only bring in the taxonomy. You just have to swap in your own tax name. And also in the first filter, your own CPT (per the link I gave)


As for your other question, are you just looking to spit out the taxonomy? I'm not sure, so I will just try to answer what I think you are asking.

            <?php   
            // Let's find out if we have taxonomy information to display   
            // Something to build our output in   
            $taxo_text = '';   

            // Variables to store each of our possible taxonomy lists   
            // This one checks for a Product Category classification   
            $prodcat_list = get_the_term_list( $post->ID, 'product_category', '', ', ', '' );

            // Add Product Category list if this post was so tagged   
            if ( '' != $prodcat_list )   
            $taxo_text .= $prodcat_list;
            ?>

I use this to store my taxonomy (product_category). I put this up at the top of my loop, above where I need to display the actual tax. Then I can spit it out using:

<?php echo $taxo_text; ?>

So the big block of code loads up the terms for product_category, and then echoing out taxo text spits out the terms, it behaves like the_category would. You would just need to swap in your tax name where I have product_category

share|improve this answer
    
Hiya Rev, Thanks for your response. I am digesting it now, and will let you know of my progress. –  don de lion Mar 29 '11 at 6:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.