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.

On the site I am currently developing I have used custom post types for the different types of content it contains (News, Podcasts, Press Releases etc). How would I go about showing the label (plus a bit of text) for each section above the loop?

For example:

Press Releases

Some text under the heading.

  • Press Release 1
  • Press Release 2
  • Press Release 3
  • Press Release 4
  • Press Release 5

Any idea how I would go about achieving this?

Thanks!

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

If the template page in question is the archive index for the custom post type, you can simply create a custom template file, archive-{post-type}.php, and add in the Title and custom text.

If you don't want to create a custom template file, you can use this boolean as a conditional in your existing archive.php template file, for creating custom output:

<?php is_post_type_archive( $post_types ); ?>

To retrieve the Title for a Post Type archive:

<?php post_type_archive_title( $prefix, $display ); ?>

To retrieve the current Post Type (for use in PHP):

<?php get_post_type( $post ) ?>

To retrieve all Post Type information (e.g. to output Title, Description, etc. if configured):

<?php get_post_type_object(); ?>
share|improve this answer
    
Just what I was after, thanks alot! –  Probocop May 11 '11 at 11:26
add comment

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.