This repository was archived by the owner on Nov 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsocial-feed.php
More file actions
72 lines (72 loc) · 1.9 KB
/
social-feed.php
File metadata and controls
72 lines (72 loc) · 1.9 KB
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
<?php
/*
Template Name: Social feed
*/
if(function_exists("sb_social_feed")):
$posts = sb_social_feed(array(
"twitter" => "severnbronies",
"tumblr" => "severnbronies",
"facebook" => "severnbronies",
"limit" => 15
));
?>
<?php
$counter = 0;
foreach($posts as $post):
if($counter >= 10):
break;
endif;
$counter++;
$post->profile = "";
$post->name = "";
?>
<div class="social-card social-card--<?php echo $post->source; ?> <?php if(!empty($post->image)): ?>social-card--has-image<?php endif; ?> grid__item">
<footer class="social-card__footer">
<?php
switch($post->source) {
case "twitter":
$post->profile = "https://twitter.com/severnbronies";
$post->name = "@severnbronies";
break;
case "facebook":
$post->profile = "https://facebook.com/severnbronies";
$post->name = "/severnbronies";
break;
case "tumblr":
$post->profile = "http://blog.severnbronies.co.uk/";
$post->name = "severnbronies";
break;
}
?>
<a class="social-card__source" href="<?php echo $post->profile; ?>"><?php echo $post->name; ?></a>
<a class="social-card__date" href="<?php echo $post->permalink; ?>">
<time datetime="<?php echo date("c", $post->timestamp); ?>" title="<?php echo date("c", $post->timestamp); ?>">
<?php echo sb_fuzzy_date($post->timestamp); ?>
</time>
</a>
</footer>
<?php
if(!empty($post->image)):
?>
<a class="social-card__media" href="<?php echo $post->permalink; ?>">
<noscript class="lazyload"><img class="social-card__image" alt="" src="<?php echo $post->image; ?>"></noscript>
</a>
<?php
endif;
?>
<div class="content social-card__body">
<?php
if($post->source == "twitter" || $post->source == "facebook"):
echo sb_content_parse($post->content);
else:
echo $post->content;
endif;
?>
</div>
</div>
<?php
endforeach;
?>
<?php
endif;
?>