0

I have a single-events.php and in there i want to show the tags on that post.

I have tried using this but nothing comes up.

I have put it within the loop but still nothing.

This is my code

<?php while ( have_posts() ) : the_post(); ?>   
<?php get_template_part( 'content', 'single' ); ?>
<h2>Tags</h2>
<?php the_tags(); ?>
<?php endwhile; // end of the loop. ?>

Am i missing something?

2
  • is it the default post_tags and not a custom taxonomy?
    – Milo
    Nov 20, 2012 at 16:11
  • Please post your register_post_type() code as well. We need to know what taxonomies your CPT supports. Nov 20, 2012 at 19:47

1 Answer 1

3

You cant display tags on a custom post type if that custom post type doesn't have tags registered. By default the Tags taxonomy is assigned to posts, you will need to register your post type accordingly.

To do so, use the taxonomies parameter:

taxonomies

(array) (optional) An array of registered taxonomies like category or post_tag that will be used with this post type. This can be used in lieu of calling register_taxonomy_for_object_type() directly. Custom taxonomies still need to be registered with register_taxonomy().

Default: no taxonomies

http://codex.wordpress.org/Function_Reference/register_post_type

1
  • if the cpt didn't have tags registered, they wouldn't have been able to associate terms with the post that they're now expecting to see on a single cpt page, so it doesn't entirely make sense that this would be the issue
    – Milo
    Nov 20, 2012 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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