forked from gbishop/TarHeelReaderTheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
55 lines (43 loc) · 1.49 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
<?php
$json = array_key_exists('json', $_GET) && $_GET['json'] == 1;
if ($json) {
$items = array();
if (have_posts()) {
while (have_posts() && count($items) < 5) {
the_post();
$item = array('title'=>get_the_title(),
'link'=>get_permalink());
$items[] = $item;
}
$result = array('announcements'=>$items);
$output = json_encode($result);
header('Content-Type: application/json');
header('Content-Size: ' . strlen($output));
echo $output;
die();
}
}
?>
<?php thr_header(''); ?>
<!-- index.php -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article <?php post_class() ?> >
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php include (TEMPLATEPATH . '/meta.php' ); ?>
<div class="entry">
<?php the_content(); ?>
</div>
<footer class="postmetadata">
<?php the_tags('Tags: ', ', ', '<br />'); ?>
Posted in <?php the_category(', ') ?> |
</footer>
</article>
<?php endwhile; ?>
<div class="navigation">
<div class="prev-posts"><?php next_posts_link('« Older Entries') ?></div>
<div class="next-posts"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
<?php else :
echo template_render('navigation', array('notfound'=>true));
endif; ?>
<?php thr_footer(); ?>