1<?php
2
3get_header();
4
5if ( have_posts() ) :
6 ?>
7 <h2><?php
8 if ( is_category() ) {
9 echo 'Category Archive';
10 }
11 ?></h2>
12 <?php
13 while ( have_posts() ) : the_post(); ?>
14
15 <article class="post">
16 <h2><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h2>
17 <p class="post-meta"><?php the_time( 'F jS, Y' ); ?> | <a
18 href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>"><?php the_author(); ?></a>
19 | <?php
20 $categories = get_the_category();
21 $comma = ', ';
22 $output = '';
23
24 if ( $categories ) {
25 foreach ( $categories as $category ) {
26 $output .= '<a href="' . get_category_link( $category->term_id ) . '">' . $category->cat_name . '</a>' . $comma;
27 }
28 echo trim( $output, $comma );
29 } ?>
30 </p>
31 <?php the_content() ?>
32 </article>
33
34 <?php endwhile;
35
36else :
37 echo '<p>There are no posts!</p>';
38
39endif;
40
41get_footer();
42
43?>
44
45
46
47
48
49
50