• nathanwinkelmes

    (@nathanwinkelmes)


    Ok so I have successfully added my categories page and each category lists all of the posts on a new page when you click on the category. The problem is that when you are taken to the specific category page the title still displays as “Categories” rather than the respective category title. I am attaching my code from archive.php in the twentyfourteen theme.

    <h1 class="page-title" style="text-transform:uppercase;">
    <?php
         if ( is_day() ) :
              printf( __( 'Daily Archives: %s', 'twentyfourteen' ), get_the_date() );
    
         elseif ( is_month() ) :
              printf( __( 'Monthly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyfourteen' ) ) );
    
         elseif ( is_year() ) :
              printf( __( 'Yearly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyfourteen' ) ) );
    
         elseif ( is_category('22') ) :
              _e('Featured Articles', 'twentyfourteen');
    
         else :
              _e( 'Categories', 'twentyfourteen' );
    
         endif;
    ?>
    </h1>

Viewing 1 replies (of 1 total)
  • Joey

    (@leglesslizard)

    Hey,

    The code above is what is displayed when you click on a date (for example the archives widget shows links to certain date archives). For displaying categories when clicking on different category names you want to be looking in the category.php template:

    <header class="archive-header">
      <h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentyfourteen' ), single_cat_title( '', false ) ); ?></h1>
    
        <?php
          // Show an optional term description.
          $term_description = term_description();
          if ( ! empty( $term_description ) ) :
            printf( '<div class="taxonomy-description">%s</div>', $term_description );
          endif;
        ?>
    </header><!-- .archive-header -->

    This should show a title with “Category Archives: Your Category Title” in the header.

    Hope that helps a tad!

Viewing 1 replies (of 1 total)
  • The topic ‘Categories Title Change’ is closed to new replies.