-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-rl_book.php
78 lines (63 loc) · 2.61 KB
/
single-rl_book.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
<?php
/**
* The template for displaying a book
*
* @package Andrew Spittle
* @since Andrew Spittle 1.0
*/
get_header(); ?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-meta">
<p class="entry-info">By <?php the_terms( $post->ID, 'book-author', '', '', '' ); ?>, added on <?php andrewspittle_posted_on(); ?></p>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<div class="entry-content">
<?php if ( post_password_required() ) : ?>
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'andrewspittle' ) ); ?>
<?php elseif ( is_single() ) : ?>
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail( 'book-cover' ); // use the custom image size we've set in functions.php
}
?>
<?php the_content(); ?>
<?php elseif ( ! has_post_thumbnail() && ! is_single() ) : {
// Props Otto http://ottopress.com/2011/photo-gallery-primer/
$attachments = get_children( array(
'post_parent' => get_the_ID(),
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID',
'numberposts' => 1)
);
foreach ( $attachments as $thumb_id => $attachment )
echo wp_get_attachment_image( $thumb_id, 'featured-thumbnail' ); // whatever size you want
}
the_excerpt();
?>
<?php else : ?>
<?php the_excerpt(); ?>
<?php endif; ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'andrewspittle' ) . '</span>', 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php //endif; ?>
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'andrewspittle' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post-<?php the_ID(); ?> -->
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( 'no-results', 'index' ); ?>
<?php endif; ?>
</div><!-- #content .site-content -->
</div><!-- #primary .content-area -->
<?php get_footer(); ?>