-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathloop.php
117 lines (112 loc) · 5.09 KB
/
loop.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/**
* The loop that displays posts
*
* The loop displays the posts and the post content. See
* http://codex.wordpress.org/The_Loop to understand it and
* http://codex.wordpress.org/Template_Tags to understand
* the tags used in it.
*
* This can be overridden in child themes with loop.php or
* loop-template.php, where 'template' is the loop context
* requested by a template. For example, loop-index.php would
* be used if it exists and we ask for the loop with:
* <code>get_template_part( 'loop', 'index' );</code>
*
* @package Bootstrap Canvas WP
* @since Bootstrap Canvas WP 1.0
*/
?>
<?php
/* Start the Loop */
if (have_posts()) : while (have_posts()) : the_post();
$date_format = get_option( 'date_format' );
?>
<div class="blog-post" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- check if the post has a Post Thumbnail assigned to it. -->
<?php if ( is_singular() && has_post_thumbnail() ) : ?>
<?php the_post_thumbnail( 'full' ); ?>
<?php elseif ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail( 'full' ); ?>
</a>
<?php endif; ?>
<?php if ( !is_singular() ) : ?>
<h2 class="blog-post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php esc_attr_e( 'Permanent Link to ', 'bootstrapcanvaswp' ) . esc_attr( the_title_attribute() ); ?>"><?php the_title(); ?></a></h2>
<?php get_template_part( 'excerpt', get_post_format() ); ?>
<?php else : ?>
<h2 class="blog-post-title"><?php the_title(); ?></a></h2>
<?php endif; ?>
<?php if ( !get_the_title() ) : ?>
<p class="blog-post-meta"><span class="glyphicon glyphicon-calendar"></span> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php esc_attr_e( 'Permanent Link to ', 'bootstrapcanvaswp' ) . get_the_title() ? esc_attr( the_title_attribute() ) : esc_attr_e( '[No Title]', 'bootstrapcanvaswp' ); ?>"><?php the_time( $date_format ) ?></a> by <span class="glyphicon glyphicon-user"></span> <?php the_author_link() ?></p>
<?php else : ?>
<!--<p class="blog-post-meta"><span class="glyphicon glyphicon-calendar"></span> <?php the_time( $date_format ) ?> by <span class="glyphicon glyphicon-user"></span> <?php the_author_link() ?></p>
<?php endif; ?> -->
<?php
/* Include the post format-specific template for the content. If you want to
* this in a child theme then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
if (is_single()) {
get_template_part( 'content', get_post_format() );
}
?>
<?php
$link_args = array(
'before' => '<ul class="pager">',
'after' => '</ul>',
'next_or_number' => 'next',
'separator' => '<li>',
'nextpagelink' => __( 'Next →', 'bootstrapcanvaswp' ),
'previouspagelink' => __( '← Previous', 'bootstrapcanvaswp' )
);
wp_link_pages( $link_args );
?>
<?php if (is_single()): ?>
<p class="blog-post-meta">
<?php if ( is_single() ) : ?>
<span class="glyphicon glyphicon-folder-open"></span> Posted in <?php the_category(', ') ?>
<strong>|</strong>
<?php endif; ?>
<?php if ( is_user_logged_in() ) : ?>
<?php edit_post_link(__( 'Edit', 'bootstrapcanvaswp' ),'<span class="glyphicon glyphicon-pencil"></span> ','<strong> |</strong>'); ?>
<?php endif; ?>
<span class="glyphicon glyphicon-comment"></span> <?php comments_popup_link( __( 'No Comments', 'bootstrapcanvaswp' ), __( '1 Comment', 'bootstrapcanvaswp' ), __( '% Comments', 'bootstrapcanvaswp' ) ); ?>
</p>
<?php if ( has_tag() ) : ?>
<p class="blog-post-meta"><span class="glyphicon glyphicon-tags"></span> <?php the_tags( __( 'Tags: ', 'bootstrapcanvaswp' ) ); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php comments_template(); ?>
</div><!-- /.blog-post -->
<!--
<?php trackback_rdf(); ?>
-->
<?php endwhile; ?>
<?php
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) :
?>
<nav>
<ul class="pager">
<li><?php next_posts_link( __( '<span class=\"meta-nav\">←</span> Older posts', 'bootstrapcanvaswp' ) ); ?></li>
<li><?php previous_posts_link( __( 'Newer posts <span class=\"meta-nav\">→</span>', 'bootstrapcanvaswp' ) ); ?></li>
</ul>
</nav>
<?php endif; ?>
<?php else : ?>
<?php if ( current_user_can( 'edit_posts' ) ) :
// Show a different message to a logged-in user who can add posts.
?>
<h2 class="center"><?php _e( 'No posts to display', 'bootstrapcanvaswp' ); ?></h2>
<p class="center">
<?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'bootstrapcanvaswp' ), admin_url( 'post-new.php' ) ); ?></p>
<?php else :
// Show the default message to everyone else.
?>
<h2 class="center"><?php _e( 'Nothing Found', 'bootstrapcanvaswp' ); ?></h2>
<p class="center">
<?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'bootstrapcanvaswp' ); ?></p>
<?php get_search_form(); ?>
<?php endif; // end current_user_can() check ?>
<?php endif; ?>