-
Notifications
You must be signed in to change notification settings - Fork 5
/
content.php
123 lines (106 loc) · 4.11 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
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
118
119
120
121
122
123
<?php
/**
* The template for displaying the Loop Content.
*
* @package StormBringer
* @since StormBringer 0.0.1
*/
?>
<?php
//$contents_per_row = 3;
?>
<?php
// Open row if $contents_per_row!=1
/*if(!is_singular() && $contents_per_row != 1){
if($wp_query->current_post % $contents_per_row == 0){
echo '<div class="content-row">';
}
}*/
$edit_link = '';
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( '' ); ?>>
<?php // Only show edit button if user has permission to edit posts
global $user_level;
if ( ($user_level > 0 && !is_singular()) || ( !is_admin_bar_showing() && $user_level > 0 && is_singular() ) ) {
$edit_link = '<a href="' . get_edit_post_link( get_the_ID() ) . '" class="btn btn-success edit-post pull-right"><span class="glyphicon glyphicon-pencil"></span> ' . __( 'Edit', 'stormbringer' ) . '</a>';
}
?>
<?php if ( is_single() || is_page() || is_singular() ) { ?>
<header class="page-header">
<?php echo $edit_link; ?>
<h1 class="entry-title page-title"><?php the_title(); ?></h1>
</header>
<?php } else { ?>
<header class="entry-header">
<?php echo $edit_link; ?>
<h2 class="entry-title">
<a title="<?php printf( esc_attr__( 'Link to %s', 'stormbringer' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h2>
</header>
<?php } ?>
<!-- /.entry-header -->
<footer class="entry-meta">
<?php if ( ( is_author() || is_category() || is_tag() || is_date() || is_home() || is_single() ) && 'post' == get_post_type() ) { // Exclude Date from SERP ?>
<p class="entry-date">
<i class="glyphicon glyphicon-calendar"></i>
<time datetime="<?php echo the_time( 'c' ); ?>" class="updated"><?php echo get_the_date( esc_attr__( 'F j, Y', 'stormbringer' ) ); ?></time>
</p>
<?php } ?>
<p class="entry-author">
<i class="glyphicon glyphicon-user"></i> <?php _e( 'By', 'stormbringer' ); ?> <span class="vcard author"><span class="fn"><?php echo get_the_author(); ?></span></span>
</p>
<?php if ( comments_open() && ! is_page() ) : ?>
<p class="comments-link">
<?php comments_popup_link( '<span class="leave-reply"><span class="glyphicon glyphicon-comment"></span> ' . __( 'Leave a comment', 'stormbringer' ) . '</span>', '<span class="glyphicon glyphicon-comment"></span> ' . _x( '1 comment', 'comments number', 'stormbringer' ), '<span class="glyphicon glyphicon-comment"></span> ' . _x( '% comments', 'comments number', 'stormbringer' ) ); ?>
</p>
<?php endif; // End if comments_open() ?>
<?php
$categories_list = get_the_category_list( __( ', ', 'stormbringer' ) );
if ( $categories_list ): ?>
<p class="entry-categories">
<?php printf( __( '<span class="%1$s"><span class="glyphicon glyphicon-book"></span> Categories:</span> %2$s', 'stormbringer' ), 'intro', $categories_list ); ?>
</p>
<?php endif; // End if $categories_list ?>
<?php
$tags_list = get_the_tag_list( '', __( ', ', 'stormbringer' ) );
if ( $tags_list ): ?>
<p class="entry-tags">
<?php printf( __( '<span class="%1$s"><span class="glyphicon glyphicon-tags"></span> Tags:</span> %2$s', 'stormbringer' ), 'intro', $tags_list ); ?>
</p>
<?php endif; // End if $tags_list ?>
</footer>
<!-- /.entry-meta -->
<div class="entry-content">
<?php if ( is_archive() || is_search() ) { ?>
<?php
if(get_the_post_thumbnail()){
echo '<a href="'.get_permalink().'">';
the_post_thumbnail();
echo '</a>';
}
?>
<?php echo get_the_excerpt(); ?>
<?php } else { ?>
<?php the_content(); ?>
<?php
// JetPack sharing
if ( function_exists( 'sharing_display' ) ) {
sharing_display( '', true );
}
?>
<?php } ?>
</div>
<!-- /.entry-content -->
</article>
<!-- /#post -->
<?php
// Close row if $contents_per_row!=1
/*if(!is_singular() && $contents_per_row != 1){
if($wp_query->current_post % $contents_per_row == ($contents_per_row - 1 )){
echo '</div>';
}
elseif (($wp_query->current_post+1) == $wp_query->post_count) {
echo '</div> <!-- the last row -->';
}
}*/
?>