Skip to main content
9 events
when toggle format what by license comment
Oct 12, 2011 at 22:23 comment added Scott Chandler I should also add, when I just type in the echo term_description code manually, it works perfectly fine.
Oct 11, 2011 at 17:49 comment added Scott Chandler Weird! The endif; is there, I just had to delete a bunch of things to get it to fit in the comment limit. This is how my taxonomies are made: function create_my_taxonomies() { register_taxonomy('projects', 'post', array( 'hierarchical' => false, 'label' => 'Projects', 'query_var' => true, 'rewrite' => true)); } add_action('init', 'create_my_taxonomies', 0);
Oct 11, 2011 at 10:44 history migrated from stackoverflow.com (revisions)
Oct 11, 2011 at 7:32 comment added daveaspinall Hi Scott, no worries. I've tried the above code and its works spot on for me? Could you show me how you're creating the custom taxonomy? Think that might be the issue. You also need an endif; just before you call get_footer. I missed a ; out the code above so ive updated it again.
Oct 10, 2011 at 22:32 comment added Scott Chandler Thanks, but it's still not working for me. Here's what I have in the single.php file: <?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $my_taxonomy = 'projects'; $terms = wp_get_post_terms( $post->ID, $my_taxonomy ) ?> <article <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h1><a href="<?php the_permalink() ?>"> <?php the_title(); ?></a></h1> <div class="entry"> <?php the_content(); ?> </div> <?php echo term_description($terms[0]->term_id, $my_taxonomy); ?> </article><?php endwhile; ?> <?php get_footer(); ?>
Oct 10, 2011 at 21:50 comment added daveaspinall also edited as I posted the wrong function, and I've also added 'projects' as the taxonomy :-)
Oct 10, 2011 at 21:35 comment added daveaspinall ok well assuming you are familiar with the WordPress loop all you need to do is place the above code wherever you want inside the loop (ive updated the answer)
Oct 10, 2011 at 20:12 comment added Scott Chandler Hmm, okay. Thank you. But how exactly do I put this all together? I'm still pretty new to PHP.
Oct 10, 2011 at 16:53 history answered daveaspinall CC BY-SA 3.0