-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-novinky.php
52 lines (39 loc) · 1.15 KB
/
single-novinky.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
<?php declare(strict_types = 1);
namespace HnutiBrontosaurus\Theme;
use HnutiBrontosaurus\Theme\DataContainers\NewsPost;
use function get_header;
use function get_post;
use function set_query_var;
/** @var Container $hb_container defined in functions.php */
set_query_var('hb_enableTracking', $hb_container->getEnableTracking()); // temporary pass setting to template (better solution is to use WP database to store these things)
get_header();
$dateForHumans = $hb_container->getDateFormatForHuman();
$post = get_post();
if ($post === null) {
// todo
}
$article = NewsPost::from($post);
?>
<main role="main">
<article class="news news--single">
<h1 class="news__item-heading">
<?php echo $article->title ?>
</h1>
<time class="news__item-date">
<?php echo $article->date->format($dateForHumans) ?>
</time>
<div class="news__item-content">
<?php if ($article->hasCoverImage): ?>
<div class="news__item-coverImage">
<img alt="" src="<?php echo $article->coverImage ?>">
</div>
<?php endif; ?>
<div>
<?php echo $article->content ?>
</div>
</div>
<div class="news__clear"></div>
</article>
</main>
<?php
get_footer();