This repository has been archived by the owner on Mar 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathloop-single.php
executable file
·81 lines (63 loc) · 2.96 KB
/
loop-single.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<article <?php post_class('article'); ?>>
<header>
<?php // 1) Link to the parent post, this is used for Pages, attachments, and custom post-types that are hierarchical ?>
<?php if ( !empty( $post->post_parent ) ) : ?>
<span></span><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php esc_attr( printf( __( 'Return to %s', 'zero' ), get_the_title( $post->post_parent ) ) ); ?>" rel="gallery"><?php
printf( __( 'Go up to %s', 'zero' ), get_the_title( $post->post_parent ) );
?></a></span>
<?php endif; ?>
<?php // 3) Display the publish date of the post ?>
<?php // 4) Display and link to the author ?>
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author(); ?></a>
<?php // 5) Display the categories for the post ?>
<?php get_the_category_list( ', ' ); ?>
<?php // 6) Display the tags for the post ?>
<?php the_tags( ); ?>
<?php // 7) Display the terms from a custom taxonomy ?>
<?php // the_terms( $post->ID, 'TAXONOMY' );?>
<?php // 8) Link to full size attachment ?>
<?php if(wp_attachment_is_image()) {
printf('<a href="%1$s">%2$s</a>', wp_get_attachment_url(), __('View full-size image', 'zero'));
} else if(wp_get_attachment_url()) {
printf('<a href="%1$s">%2$s</a>', wp_get_attachment_url(), __('Download', 'zero'));
}?>
<?php // 9) Display attachment meta data ?>
<?php if ( is_attachment() && $metadata = wp_get_attachment_metadata()) {
echo '<dl class="attachments">';
foreach($metadata as $key => $val) {
echo '<dt>'.$key.'</dt>';
echo '<dd>';
switch($key) {
case 'image_meta':
echo '<dl>';
foreach($val as $imk => $imv) {
echo '<dt>'.$imk.'</dt>';
echo '<dd>'.$imv.'</dd>';
}
echo '</dl>';
break;
case 'sizes':
echo '<ul>';
foreach($val as $size) {
$image_url = wp_get_attachment_image_src($post->ID, array($size['width'], $size['height']));
echo '<li><a href="'.$image_url[0].'">'.$size['width'].'x'.$size['height'].'</a></li>';
}
echo '</ul>';
break;
default:
echo $val;
}
echo '</dd>';
}
echo '</dl>';
} ?>
</header>
<div class="prose"><?php the_content(); ?></div>
<footer>
<?php edit_post_link( __( 'Edit', 'zero' ), ' <span class="edit-link">', '</span>' ); ?>
<?php wp_link_pages( array( 'before' => '<div class="pager">' . __( 'Pages:', 'zero' ), 'after' => '</div>' ) ); ?>
</footer>
<?php comments_template( '', true ); ?>
</article>
<?php endwhile; // end of the loop. ?>