0

I have this in the archive.php file of my theme:

<?php else : ?>
  <h1 class="archive-title"><?php printf( __( get_post_type() ) ); ?></h1>
<?php endif; ?>

And it returns the slug for the post type. I'd like it to return the plural name of the post type instead. What should I use to replace get_post_type()?

1 Answer 1

2

Figured it out:

<h1 class="archive-title">
  <?php echo get_post_type_object( get_post_type() )->label; ?>
</h1>
1
  • Great if you can solve your own problem. +1 for that, and also posting your solution. Don't forget to accept your own answer. Commented Mar 2, 2014 at 6:12

Your Answer

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

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