-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
executable file
·78 lines (62 loc) · 3.27 KB
/
index.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 the home/index page.
* This template will also be called in any case where the Wordpress engine
* doesn't know which template to use (e.g. 404 error)
*/
get_header(); // This fxn gets the header.php file and renders it ?>
<div class="banner">
ROSIE SAYS
</div>
<?php if ( have_posts() ) :
// Do we have any posts in the databse that match our query?
// In the case of the home page, this will call for the most recent posts
?>
<?php while ( have_posts() ) : the_post();
// If we have some posts to show, start a loop that will display each one the same way
?>
<article class="post">
<h1 class="title">
<a href="<?php the_permalink(); // Get the link to this post ?>" title="<?php the_title(); ?>">
<?php the_title(); // Show the title of the posts as a link ?>
</a>
</h1>
<div class="post-meta">
<?php the_time('m.d.Y'); // Display the time published ?> |
<?php if( comments_open() ) : // If we have comments open on this post, display a link and count of them ?>
<span class="comments-link">
<?php comments_popup_link( __( 'Comment', 'break' ), __( '1 Comment', 'break' ), __( '% Comments', 'break' ) );
// Display the comment count with the applicable pluralization
?>
</span>
<?php endif; ?>
</div><!--/post-meta -->
<div class="the-content">
<?php the_content( 'Continue...' );
// This call the main content of the post, the stuff in the main text box while composing.
// This will wrap everything in p tags and show a link as 'Continue...' where/if the
// author inserted a <!-- more --> link in the post body
?>
<?php wp_link_pages(); // This will display pagination links, if applicable to the post ?>
</div><!-- the-content -->
<?php if (false) :
// This is wrapped in a false statement to not render it.
// Take off this conditional if you want this meta displayed for each post
?>
<div class="meta clearfix">
<div class="category"><?php echo get_the_category_list(); // Display the categories this post belongs to, as links ?></div>
<div class="tags"><?php echo get_the_tag_list( '| ', ' ' ); // Display the tags this post has, as links separated by spaces and pipes ?></div>
</div><!-- Meta -->
<?php endif; ?>
</article>
<?php endwhile; // OK, let's stop the posts loop once we've exhausted our query/number of posts ?>
<!-- pagintation -->
<div id="pagination" class="clearfix">
<div class="past-page"><?php previous_posts_link( 'newer' ); // Display a link to newer posts, if there are any, with the text 'newer' ?></div>
<div class="next-page"><?php next_posts_link( 'older' ); // Display a link to older posts, if there are any, with the text 'older' ?></div>
</div><!-- pagination -->
<?php else : // Well, if there are no posts to display and loop through, let's apologize to the reader (also your 404 error) ?>
<article class="post error">
<h1 class="404">Nothing posted yet</h1>
</article>
<?php endif; // OK, I think that takes care of both scenarios (having posts or not having any posts) ?>