forked from gbishop/TarHeelReaderTheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
front-page.php
71 lines (64 loc) · 1.75 KB
/
front-page.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
<?php
// check for a restart from an iOS device
global $log;
if (!is_ajax() && array_key_exists('thr', $_COOKIE)) {
$json = $_COOKIE['thr'];
$json = stripslashes($json); // magic quotes?
$value = json_decode($json, true);
if (array_key_exists('lastURL', $value)) {
thr_setcookie(1);
$home = home_url();
$url = $value['lastURL'];
$log->info("home=$home");
$log->info("url=$url");
if (strpos($url, $home) === 0) {
$url = substr($url, strlen($home));
$log->info("relative=$url");
if ($url != '/') {
$log->info('ios restart redirect');
header('Location: ' . $url);
die();
}
}
}
}
thr_header('home-page'); ?> <!-- front-page.php -->
<?php
$content = '';
if (have_posts()) {
while (have_posts()) {
the_post();
$content .= get_the_content();
}
}
query_posts("cat=9&posts_per_page=4");
$announcements = array();
if (have_posts()) {
while (have_posts()) {
the_post();
$ann = array(
'title' => get_the_title(),
'link' => get_permalink());
$announcements[] = $ann;
}
}
?>
<article>
<div class="post" >
<div class="entry">
<?php
// construct the view for the template
$view = array(
'wellicon' => '<img src="/theme/images/well.png" class="tinyicon" title="old well icon" alt=" "/>',
'gearicon' => '<img src="/theme/images/settings.png" class="tinyicon" title="gear icon" alt=" "/>',
'Flickr' => '<a href="http://flickr.com">Flickr</a>',
'locales' => $Templates['locales'],
'content' => $content,
'announcements' => $announcements
);
echo template_render('frontPage', $view);
?>
</div>
</div>
</article>
<?php thr_footer(); ?>