WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Titles (3 posts)

  1. Rami Yushuvaev
    Member
    Posted 3 years ago #

    Titles Question - when using custom taxonomies and custom post types:

    • on tag.php template file, we use the single_tag_title() function.
    • on category.php template file, we use the single_cat_title() function.
    • on taxonomy.php template file, we use the single_term_title() function.
    • on archive-{posttype}.php template file, what function we need to use?
  2. Bill Erickson
    Member
    Posted 3 years ago #

    I believe the appropriate function is <?php post_type_archive_title(); ?>

    But personally I pull in the whole post type object in case there's anything more than the title I need

    $post_type = get_post_type();
    		$post_type_object = get_post_type_object($post_type);
    		echo $post_type_object->labels->name;

    If you do a print_r($post_type_object) you can see all the data you get.

    More info:
    http://codex.wordpress.org/Function_Reference/post_type_archive_title
    http://codex.wordpress.org/Function_Reference/get_post_type_object

  3. Rami Yushuvaev
    Member
    Posted 3 years ago #

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic