-
Notifications
You must be signed in to change notification settings - Fork 27
/
templates.php
150 lines (113 loc) · 5.81 KB
/
templates.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
<script type="text/tmpl" id="home-view">
<div class="post-list">
{[ if(posts.length) { ]}
{[ _.each(posts, function(post){ ]}
<article class="post">
<h2>
<a href="{{ post.get('link') }}">{{ post.get("title") }}</a>
</h2>
<div class="entry-meta">
</div>
<div class="entry-content">{{ post.get('content') }}</div>
</article>
{[ }); ]}
{[ } else { ]}
<h2>No posts found</h2>
{[ } ]}
{[ if ( pages > 1 ) { ]}
<div class="pagination pagination-centered"><ul>
{[ for (var i = 1; i <= pages; i++) { ]}
{[ className = (i == currentPage) ? ' class="active"' : '' ]}
<li{{ className }}><a href="#/p/{{ i }}">{{ i }}</a></li>
{[ } ]}
</div></ul>
{[ } ]}
</div>
</script>
<script type="text/tmpl" id="single-post-view">
<div class="post-list">
<article class="post">
<h2>{{ post.get("title") }}</h2>
<div class="entry-meta">
Written by {{ post.get('author').get('name') }}
on {{ post.get('date') }}
</div>
<div class="entry-content">{{ post.get('content') }}</div>
<div id="comments">Loading...</div>
</article>
</div>
</script>
<script type="text/tmpl" id="single-page-view">
<div class="post-list">
<article class="post">
<h2>{{ post.get("title") }}</h2>
<div class="entry-content">{{ post.get('content') }}</div>
</article>
</div>
</script>
<script type="text/tmpl" id="comments-view">
{[ if (comments.length) { ]}
<h2 id="comments-title">{{ comments.length }} comments!</h2>
<ol class="commentlist">
{[ _.each(comments, function(comment){ ]}
<li id="li-comment-{{ comment.get('ID') }}">
<article class="comment">
<footer>
<div class="comment-author vcard">
<div class="comment-avatar"><img class="avatar" src="{{ comment.get('author').avatar }}" alt="avatar" /></div>
<cite class="fn">{{ comment.get('author').name }} </cite> <span class="says">says:</span>
</div>
</footer>
{[ if (comment.get('status') !== 'approved' ) { ]}
<em><?php _e( 'Your comment is awaiting moderation.', 'wedevs' ); ?></em>
<br />
{[ } ]}
<div class="comment-content">{{ comment.get('content') }}</div>
</article>
</li>
{[ }); ]}
</ol>
{[ } else { ]}
<h2 id="comments-title">No comments found!</h2>
{[ } ]}
{[ if (post.get('comment_status') === 'open') { ]}
<div id="respond" class="comment-respond">
<form action="<?php //echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="commentform" class="comment-form">
<?php
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " required='required'" : '' );
?>
<?php if ( is_user_logged_in() ) : ?>
You are logged in
<?php else : ?>
<?php
$commenter = wp_get_current_commenter();
$user = wp_get_current_user();
$user_identity = $user->exists() ? $user->display_name : '';
$html5 = true;
$fields = array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
'<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
);
foreach ( $fields as $name => $field ) {
echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
}
?>
<?php endif; ?>
<p class="comment-form-comment">
<label for="comment"><?php echo _x( 'Comment', 'noun' ); ?></label>
<textarea id="comment" name="comment" cols="45" rows="8"<?php echo $aria_req; ?>></textarea>
</p>
<p class="form-submit">
<input class="btn" name="submit" type="submit" id="submit" value="<?php echo esc_attr( __( 'Post Comment' ) ); ?>" />
<input type='hidden' name='comment_post_ID' value='{{ post.get('ID') }}' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
</p>
</form>
</div>
{[ } ]}
</script>