-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
61 lines (61 loc) · 2.11 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
<?php
get_header();
?>
<section class="titlesection ">
<div class="">
<div class="container">
<h1><?php the_title(); ?></h1>
<div>
<span><?php the_time('F j, Y'); ?> </span>
<span><?php the_tags("<br><span> The tags: ", " </span>"); ?>
<br>
<span> Author: <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php the_author(); ?>
</a>
</span>
<br>
<p>Categores: <?php
$categories = get_the_category();
$seprator = " , ";
$output = " ";
if ($categories) {
foreach ($categories as $category) {
$output .= '<a href="' . get_category_link($category->term_id) . '">' . $category->cat_name . '</a>' . $seprator;
}
echo trim($output, $seprator);
}
?>
</p>
<span><?php comments_number() ?></span>
</div>
</div>
</div>
</section>
<div class="container">
<div class="m-5">
<!-- <?php the_post_thumbnail(); ?> instead of just using this one line code can use the pro -->
<?php
if(has_post_thumbnail()){
$image = array(
'alt' => get_the_title(),
'title' => get_the_title()
);
the_post_thumbnail('', $image);
}else{
echo"<img src=''>";//when the post have no images
}
?>
</div>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
// the_content( );
get_template_part('template-parts/content', 'article');
}
}
comments_template();
?>
</div>
<?php
get_footer();
?>