Forums

[resolved] How do I display the Category or Tag name on the Archives page? (3 posts)

  1. lucid_design
    Member
    Posted 1 year ago #

    This question relates to coding the archive.php file.

    I want the name of the category parent, category child or tag to display on the page above the list of posts. Don't know how to encode that.

    On the single.php file, the post title is noted as <?php the_title(); ?>

    I experimented with that for accessing the category or tag name, but no luck.

    Here's one of my archive pages. I want the Category name (in this case, 'Quotes') to appear under the olive green flourish.

    http://albereo.com/melanie/category/quotes/

    Thanks to anyone with a solution.

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    if you have a copy of the kubrick default theme, see in their archive.php how it can be done.

    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
     	  <?php /* If this is a category archive */ if (is_category()) { ?>
    		<h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>
     	  <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
    		<h2 class="pagetitle">Posts Tagged ‘<?php single_tag_title(); ?>’</h2>
     	  <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    		<h2 class="pagetitle">Archive f...............
  3. lucid_design
    Member
    Posted 1 year ago #

    Thank you, worked perfectly.

Topic Closed

This topic has been closed to new replies.

About this Topic