forked from Amunds/kvarteret_theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
single.php
executable file
·92 lines (83 loc) · 2.99 KB
/
single.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
<?php
/**
* The Template for displaying all single posts.
*
* @package WordPress
* @subpackage kvarteret
* @since Kvarteret 1.0
*/
get_header(); ?>
<div class="all_cols content" role="main">
<?php if(has_post_thumbnail()) { ?>
<div class="wrapper post_thumbnail">
<?php the_post_thumbnail('full-thumbnail'); ?>
<h1 class="article post_thumbnail"><?php the_title(); ?></h1>
</div>
<?php } else { ?>
<h1><?php the_title(); ?></h1>
<?php } ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div class="article meta byline">
<?php the_post_thumbnail_caption(); ?>
</div>
<div class="two_cols left date meta text_right">
<div class="right date_wrap">
<span class="bebas day huge right"><?php the_time('d'); ?></span>
<span class="month"><?php the_time('M'); ?></span>
<span class="year"><?php the_time('Y'); ?></span>
</div>
</div>
<div class="two_cols right">
<span class="bebas left author huge">av</span>
<?php
$custom_author = get_post_meta($post->ID, "article_author", true);
$curauth = get_the_author();
$custom_author ? $author = $custom_author : $author = $curauth;
if ( $custom_author ) {
echo $custom_author;
}
else {
echo $curauth;
}
?>
</div>
<div class="six_cols center article content">
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
</div>
<div class="six_cols center cf share">
<h2>Del</h2>
<a href="https://www.facebook.com/sharer.php?u=<?php echo urlencode(get_permalink()); ?>&t=<?php echo urlencode(get_the_title()); ?>" class="facebook_share" title="Del på Facebook">Del på facebook</a>
<a href="http://twitter.com/share?url=<?php echo urlencode(get_permalink()); ?>&text=<?php the_title(); ?>&via=Kvarteret" target="_blank" rel="nofollow" class="twitter_share" alt="Del på Twitter">Del på Tweet</a>
</div>
<?php endwhile; // end of the loop. ?>
</div>
<script type="text/javascript">
$(document).ready(function() {
url = "<?php echo get_permalink(); ?>";
//var url = "http://kvarteret.no";
// Get number of Tweets for this article
$.getJSON('http://api.tweetmeme.com/url_info.jsonc?url='+url+'&callback=?',
function(data) {
var tweets = 0;
if('story' in data) {
tweets = data.story.url_count;
console.log('tweets' + data.story.url_count);
}
$('.twitter_share').append('<div class="count">' + tweets + '</div>');
});
// Get number of Likes (Shares + likes + mentions)
$.getJSON('http://graph.facebook.com/?id='+url+'&callback=?',
function(data) {
var shares = 0;
if('shares' in data) {
shares = data.shares;
console.log('Likes' + data.shares);
}
$('.facebook_share').append('<div class="count">' + shares + '</div>');
});
});
</script>
<?php get_footer(); ?>