WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to display the current archives name, so for the url below I could do something like this

<h1><?php echo "answer" ?></h1>

which would output something like this


or better yet

<h1>News: supplierName</h1>


share|improve this question
up vote 1 down vote accepted

This is probably what you need:

<?php if (is_category()) { // Show only on Category archive pages ?>
<h1><?php echo single_cat_title('News: '); ?></h1>

<?php } elseif (is_tag()) { // Show only on Tag archive pages ?>
<h1><?php echo single_tag_title('News: '); ?></h1>

<?php } ?>

OR like this (as @StephenHarris pointed out):

    if ( is_category() || is_tag() ) {
        single_term_title( 'News: ', false );
share|improve this answer
See inside wp_title (see source) for similar functions. Many take a prefix as an argument, e.g. 'News: ' in the OP's question. – Stephen Harris Jun 29 '12 at 14:08
Yup - but I was just linking there in case others need to find a similar function for a different context :) – Stephen Harris Jun 29 '12 at 14:18

Your Answer


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.