forked from KeywordDomains/Lehti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
executable file
·149 lines (120 loc) · 3.71 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
/**
*@desc A single blog post See page.php is for a page layout.
*/
get_header();
?>
<?php
if (have_posts()) : while (have_posts()) : the_post();
$imgdata = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
$largeFeature = ($imgdata[1] > 1100) ? true : false;
?>
<?php if(has_post_thumbnail() && $largeFeature) { ?>
<?php get_template_part('single', 'head'); ?>
<?php } ?>
<?php
?>
<div id="main" role="main" class="hfeed">
<section id="content" <?php post_class(); ?>>
<div class="post-inner">
<?php if(!has_post_thumbnail() || !$largeFeature) { ?>
<h1 class="entry-title beta"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php } ?>
<div class="entry-content">
<?php if(has_post_thumbnail() && !$largeFeature) {
the_post_thumbnail('single_image', array('class' => 'alignright'));
$data = wp_get_attachment_metadata( get_post_thumbnail_id() );
if($data['image_meta']['copyright']) {
_e('Photo ©', 'boloday');
echo $data['image_meta']['copyright'];
}
} ?>
<?php the_content(__('(more...)', 'boloday')); ?>
<?php wp_link_pages( ); ?>
</div>
<?php if(get_the_tags() != '') { ?>
<div class="post-tags">
<?php the_tags(); ?>
</div>
<?php } ?>
<div class="post-meta">
<div class="info">
<span class="vcard author"><span class="fn"><?php the_author(); ?></span></span>
<abbr class="date published updated" title="<?php the_date('r'); ?>"><?php echo get_the_date('m/d'); ?></abbr>
</div>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4fe1827d1a10d6d8"></script>
<!-- AddThis Button END -->
</div>
<?php
// Related Posts
global $post, $wpdb;
$backup = $post; // backing up the old post
$tags = wp_get_post_tags($post->ID);
$tagIDs = array();
if($tags) {
$tagcount = count($tags);
for($i = 0; $i < $tagcount; $i++) {
$tagIDs[$i] = $tags[$i]->term_id;
}
$args = array(
'tag__in' => $tagIDs,
'post__not_in' => array($post->ID),
'showposts' => 3,
'ignore_sticky_posts' => 1
);
$query = new WP_Query($args);
if($query->have_posts()) {
$related_found = true;
?>
<div class="post-foot">
<h3><?php _e('Related Posts', 'boloday'); ?></h3>
<ul class="related">
<?php while($query->have_posts()) : $query->the_post(); ?>
<li>
<?php if(has_post_thumbnail()) { ?>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('square'); ?>
</a>
</div>
<?php } ?>
<h4><a href="<?php the_permalink(); ?>" class="more"><?php the_title(); ?></a></h4>
<p>
<?php truncate_post(60); ?>
</p></li>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>
</div> <!-- post-foot -->
<?php
}
}
get_template_part('inc/breadcrumbs');
?>
<?php
comments_template();
?>
</div>
</section>
<aside id="sidebar">
<?php get_sidebar(); ?>
</aside>
</div>
<?php
endwhile; else: ?>
<?php get_template('404', 'search'); ?>
<?php
endif;
?>
<?php
get_footer();
?>