• Resolved yozoh

    (@yozoh)


    Hello, I have a problem.

    If I click “news” category, There is no sign like “‘news’ archives”.
    Just showing the posts.
    (https://tha.jp)

    I want to display archive title.

    How can I resolve this problem?
    I need your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • here is some example code from the kubrick default theme, that does the title showing for the various archives:
    (you could use the full code or just check the various template tags for reference – and look them up in the codex docu)

    <?php if ( is_archive() ) {
    $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 for <?php the_time('F jS, Y'); ?></h2>
     	  <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    		<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
     	  <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    		<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
    	  <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    		<h2 class="pagetitle">Author Archive</h2>
     	  <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
    		<h2 class="pagetitle">Blog Archives</h2>
     	  <?php }
    } ?>

    if your theme has an archive.php file, you can add this code where you want your categeory title to show;
    if not, you have two possibilities:
    1.
    make a copy of index.php and save it under the name archive.php; then edit as before;
    or
    2.
    add the code into index.php directly where you want the category title to show.

    Thread Starter yozoh

    (@yozoh)

    Thank you so much.
    It works.
    ??

    I really appreciate your advice.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Showing the name of selected tag or category’ is closed to new replies.