This repository was archived by the owner on Jun 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsingle.php
More file actions
133 lines (133 loc) · 4.61 KB
/
single.php
File metadata and controls
133 lines (133 loc) · 4.61 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
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
<?php
/*
* The template for displaying Single.
*
* @package ThemeIsle
*/
get_header();
?>
<div id="main-content">
<div class="inner cf">
<div class="blog-left">
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<article <?php post_class( 'single-margin-top' ); ?>>
<h1 class="post-title"><?php the_title(); ?></h1>
<div class="post-meta">
<?php _e( 'Posted by', 'constructzine-lite' ); ?> <?php the_author_posts_link(); ?> <?php _e( 'in', 'constructzine-lite' ); ?> <?php the_category( ', ' ); ?>
, <?php _e( 'on', 'constructzine-lite' ); ?><?php echo the_time( get_option( 'date_format' ) ); ?>
</div>
<!--/.post-meta-->
<div class="single-post-image">
<?php
if ( $featured_image != null ) {
?>
<div class="asd" style="background-image: url('<?php echo $featured_image[0]; ?>');">
</div>
<?php
}
?>
</div>
<!--/.single-post-image-->
<div class="post-entry">
<?php the_content(); ?>
</div>
<!--/.post-entry-->
<?php
wp_link_pages(
array(
'before' => '<div class="post-links"><span class="post-links-title">' . __( 'Pages:', 'constructzine-lite' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
)
);
?>
<div class="post-tags">
<?php the_tags( 'Tags: ', ', ' ); ?>
</div>
<!--/.post-tags-->
<div class="single-navigation cf">
<div class="single-navigation-left">
<?php previous_post_link( '%link', 'Previous Post', true ); ?>
</div>
<!--/.single-navigation-left-->
<div class="single-navigation-right">
<?php next_post_link( '%link', 'Next Post', true ); ?>
</div>
<!--/.single-navigation-right-->
</div>
<!--/.single-navigation .cf-->
<div class="similar-articles cf">
<div class="title-border">
<h3><?php _e( 'Similar Articles', 'constructzine-lite' ); ?></h3>
</div>
<!--/.title-border-->
<div class="similar-articles-box">
<?php
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$args = array(
'post_type' => 'post',
'orderby' => 'rand',
);
$random_posts = new WP_Query( $args );
if ( $random_posts->have_posts() ) {
while ( $random_posts->have_posts() ) {
$random_posts->the_post(); ?>
<div class="similar-article responsive">
<span>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php
if ( strlen( $post->post_title ) > 25 ) {
echo substr( the_title( $before = '', $after = '', false ), 0, 25 ) . '...';
} else {
the_title();
} ?>
</a>
</span>
<?php echo constructzine_lite_excerpt_limit_length( get_the_excerpt(), '27' ); ?>
</div><!--/.similar-article-->
<?php
}
} else {
?>
<?php _e( 'No posts found.', 'constructzine-lite' );
}
wp_reset_postdata();
?>
</div>
<!--/.similar-articles-box-->
<a href="" title="Previous" class="similar-articles-prev">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="20" height="20" viewBox="0 0 32 32">
<path
d="M23.038 27.869c0.429 0.434 0.429 1.133 0 1.566s-1.122 0.434-1.55 0l-12.528-12.651c-0.429-0.434-0.429-1.134 0-1.566l12.528-12.653c0.429-0.434 1.122-0.434 1.55 0s0.429 1.133 0 1.566l-11.424 11.869 11.424 11.869z"></path>
</svg>
</a><!--/.similar-articles-prev-->
<a href="" title="Next" class="similar-articles-next">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
width="20" height="20" viewBox="0 0 32 32">
<path
d="M8.96 27.869c-0.429 0.434-0.429 1.133 0 1.566s1.122 0.434 1.55 0l12.528-12.651c0.429-0.434 0.429-1.134 0-1.566l-12.528-12.653c-0.429-0.434-1.122-0.434-1.55 0s-0.429 1.133 0 1.566l11.424 11.869-11.424 11.869z"></path>
</svg>
</a><!--/.similar-articles-next-->
</div>
<!--/.similar-articles-->
<?php comments_template(); ?>
</article><!--/article-->
<?php
}
} else {
echo __( 'No posts found', 'constructzine-lite' );
}
?>
</div>
<!--/.blog-left-->
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>