forked from Facens/wpbootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loop.php
184 lines (152 loc) · 6.22 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?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 WordPress
* @subpackage wpbootstrap
* @since wpbootstrap 0.1
*/
?>
<?php
// Filters for adding classes to various functions
$comments_link_attributes_css = 'btn small primary';
?>
<?php /* If there are no posts to display, such as an empty archive page */ ?>
<?php if ( ! have_posts() ) : ?>
<article>
<h1 class="page-header"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
<div class="alert-message block-message error">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
<div class="alert-actions">
<?php get_search_form(); ?>
</div>
</div>
</article>
<?php endif; ?>
<?php
global $sa_options;
$sa_settings = get_option( 'sa_options', $sa_options );
?>
<?php
/* Start the Loop.
*
* In Twenty Ten we use the same loop in multiple contexts.
* It is broken into three main parts: when we're displaying
* posts that are in the gallery category, when we're displaying
* posts in the asides category, and finally all other posts.
*
* Additionally, we sometimes check for whether we are on an
* archive page, a search page, etc., allowing for small differences
* in the loop on each template without actually duplicating
* the rest of the loop that is shared.
*
* Without further ado, the loop:
*/ ?>
<?php
// Set the first post value to 1, outside the loop
if ( ( is_paged() == false && $sa_settings['compact_homepage'] == '1' ) || ( $sa_settings['compact_homepage'] == false ) ) { $firstpost = '1'; }
?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
if ( $firstpost == '1' ) :
?>
<article>
<h1 class="page-header">
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</h1>
<?php endif; ?>
<?php
if ( $firstpost == '' ) :
?>
<h2 class="page-header" style="margin-top: 50px;">
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</h2>
<?php endif; ?>
<p class="muted">
<?php twentyten_posted_on(); ?>
</p>
<hr />
<?php
// Compact home page if start
if ( $firstpost == '1' ) :
?>
<article class="post_content" itemscope itemType="http://schema.org/BlogPosting">
<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
<?php the_excerpt(); ?>
<?php else : ?>
<?php the_content( __( 'Continue reading →', 'twentyten' ) ); ?>
<?php
wpbootstrap_link_pages_list(array( 'before' => '<nav class="pagination pagination-centered"><ul>', 'after' => '</ul></nav>'));
?>
<?php endif; ?>
</article>
<p class="muted">
<?php twentyten_posted_on(); ?>
|
<?php if ( count( get_the_category() ) ) : ?>
<?php printf( __( 'Posted in %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
<?php endif; ?>
<?php
$tags_list = get_the_tag_list( '', ', ' );
if ( $tags_list ):
?>
|
<?php printf( __( 'Tagged %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
<?php endif; ?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '| ', '' ); ?>
</p>
<hr />
<div class="well">
<?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ),$comments_link_attributes_css); ?>
<?php
if( $sa_settings['social_buttons'] == '1' ) :
?>
<div class="post_social_buttons">
<iframe src="http://www.facebook.com/plugins/like.php?app_id=124765724272783&href=<?php the_permalink(); ?>&send=false&layout=button_count&width=450&show_faces=false&action=like&colorscheme=light&font=lucida+grande&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:20px;" allowTransparency="true"></iframe>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink(); ?>" data-count="horizontal">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<g:plusone size="medium" href="<?php the_permalink(); ?>"></g:plusone>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
</div>
<?php endif; ?>
</div> <!-- /well -->
<?php comments_template( '', true ); ?>
</article>
<?php
// Block this part of the loop by setting $firstpost to '0'
if( $sa_settings['compact_homepage'] == '1' && is_home() == true) { $firstpost = ''; }
?>
<?php
// Compact home page if end
endif; ?>
<?php endwhile; // End the loop. Whew. ?>
<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<nav>
<ul class="pager">
<li class="previous">
<?php next_posts_link( __( '← Older posts', 'twentyten' ) ); ?>
</li>
<li class="next">
<?php previous_posts_link( __( 'Newer posts →', 'twentyten' ) ); ?>
</li>
</ul>
</nav>
<?php endif; ?>