-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.php
executable file
·45 lines (45 loc) · 1.06 KB
/
content.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<article>
<header>
<?php
if ( is_search() || is_archive() ) {
echo '<a href="' . get_permalink() . '">';
}
?>
<h1><?php the_title(); ?></h1>
<?php
if ( is_search() || is_archive() ) {
echo '</a>';
}
if ( is_search() || is_archive() || is_single() ) {
$date_format = get_option( 'date_format' ); ?>
<time datetime="<?php echo get_the_date( $date_format ); ?>"><?php echo get_the_date(); ?></time>
<?php } ?>
</header>
<?php
if ( is_search() || is_archive() ) {
the_excerpt();
} else {
the_content();
}
?>
<footer>
<?php
if ( is_single() ) {
$taxonomies = get_object_taxonomies( $post->post_type );
foreach ( $taxonomies as $taxonomy ) {
$terms = get_the_terms( $post->ID, $taxonomy );
if ( ! empty( $terms ) ) {
echo '<nav>';
echo "<h4>" . get_taxonomy( $taxonomy )->label . "</h4>";
echo "<ul>";
foreach ( $terms as $term ) {
echo "<li><a href='" . get_term_link( $term ) . "'>" . $term->name . "</a></li>";
}
echo "</ul>";
echo "</nav>";
}
}
}
?>
</footer>
</article>