-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop.php
90 lines (80 loc) · 2.8 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
<?php
/*
*** Human Aquarium 1.0 ***
* Generic loop, uses this if no template part specified
*/
?>
<main id="maincontent" class="column2" role="main">
<h1 class="entry-title"><?php wp_title('') ?></h1>
<?php if ( have_posts () ) : ?>
<?php if ( ($wp_query->post_count) > 1 ) : ?>
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class() ?> id="post-<?php the_ID(); ?>" role="article">
<header>
<h2 class="entry-title">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a>
</h2>
<p class="author">By <?php the_author(); ?></p>
<time class="date"><?php the_time('F jS, Y') ?></time>
</header>
<div class="entry">
<?php if ( has_post_thumbnail() ) :?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="featured-image alignright">
<?php the_post_thumbnail('medium'); ?>
</a>
<?php endif; ?>
<?php the_excerpt(); ?>
</div><!--.entry-->
<footer>
<p class="postmetadata">
<?php _e( 'Posted in' ); ?> <?php the_category( ', ' ); ?><br>
<?php the_tags('Tags: ', ', ', '<br />'); ?>
</p><!-- .metadata-->
</footer>
</article><!-- finish enclosing post-->
<?php endwhile; else : ?>
<?php while (have_posts()) : the_post(); ?>
<!-- Do your post header stuff here for single post-->
<article <?php post_class() ?> id="post-<?php the_ID(); ?>" role="article">
<header>
<h2 class="entry-title">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a>
</h2>
<p class="author">By <?php the_author(); ?></p>
<time class="date"><?php the_time('F jS, Y') ?></time>
</header>
<div class="entry">
<?php the_content() ?>
</div><!--.entry-->
<footer>
<p class="postmetadata">
<?php _e( 'Posted in' ); ?> <?php the_category( ', ' ); ?><br>
<?php the_tags('Tags: ', ', ', '<br />'); ?>
</p><!-- .metadata-->
</footer>
</article> <!-- finish enclosing post-->
<?php endwhile; endif; else :?>
<!-- Stuff to do if there are no posts-->
<h2 class="entry-title">Not found</h2>
<p>Sorry, no posts matched your criteria. Perhaps searching will help</p>
<?php get_search_form(); ?>
<?php endif; ?>
<!--bottom navigation to older and newer posts if there is more than one page of posts-->
<div class="page-navigation">
<?php
/*
** pagination
*/
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
) );
?>
</div><!--.navigation-->
</main>