-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathphotoCredits.php
55 lines (50 loc) · 1.38 KB
/
photoCredits.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
/*
Template Name: PhotoCredits
Link back to Flickr to give photographers credit
*/
?>
<?php thr_header(''); ?>
<!-- photoCredits.php -->
<?php if (have_posts()):
while (have_posts()):
the_post(); ?>
<article>
<div <?php post_class(); ?> >
<h2 class="entry-title"><?php the_title(); ?></h2>
<div class="entry-content">
<?php the_content(); ?>
<?php
// get the bookid
$ID = getParam('id', '', '/^\d+$/');
if ($ID) {
$post = get_post($ID);
$book = ParseBookPost($post);
if ($book) {
$view = array();
$view['title'] = $book['title'];
$view['ID'] = $ID;
$photos = array_slice($book['pages'], 1);
foreach ($photos as &$photo) {
if (strpos($photo['url'], '/uploads/') === false) {
$parts = explode('/', $photo['url']);
$photoID = explode('_', $parts[count($parts) - 1]);
$photoID = $photoID[0];
$photo['infolink'] = "https://flickr.com/photo.gne?id=$photoID";
}
setImageSizes($photo);
}
$view['photos'] = $photos;
echo template_render('photoCredits', $view);
$backto = get_permalink($ID);
echo "<a href=\"$backto\">Back to your book</a>";
}
}
?>
</div>
</div>
</article>
<?php
endwhile;
endif; ?>
<?php thr_footer(); ?>