-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsingle.php
48 lines (40 loc) · 1.15 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
<?php
get_header();
?>
<?php
if(have_posts()) : while(have_posts()) : the_post();
?>
<header id="site-content" class="news-item__header
<?php if ( !has_post_thumbnail() ) echo 'news-item__header--short-header'; ?>">
<h1 class="news-item__title--large"><?php the_title(); ?></h1>
<div class="news-item__meta--large">
<?php $parentscategory = "";
$has_cats = false;
foreach((get_the_category()) as $category) {
if ($category->category_parent == 0) {
$cat_link = get_category_link($category->cat_ID);
$cat_name = $category->name;
$parentscategory .= ' <a ' .
'href="' . $cat_link . '"' .
'class="news-item__category"' .
'title="' . $cat_name . '">' .
$cat_name . '</a>, ';
$has_cats = true;
}
}
if ($has_cats) echo substr($parentscategory,0,-2) . ' | '; ?>
<?php echo get_the_date(); ?>
</div>
<?php if ( has_post_thumbnail() ) : ?>
<?php the_post_thumbnail('post-thumbnail',
array( 'class' => 'news-item__thumb--large')
); ?>
<?php endif; ?>
</header>
<main class="primary-content">
<?php the_content(); ?>
</main>
<?php
endwhile; endif;
get_footer();
?>