-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfiltred_posts.php
41 lines (35 loc) · 1.4 KB
/
filtred_posts.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
<?php require_once 'config.php' ?>
<?php require_once 'includes/public_functions.php' ?>
<?php require_once 'includes/head_section.php';
if (isset($_GET["topic"])){
$topic_id = $_GET["topic"];
$posts = getPublishedPostsByTopic($topic_id);
}
?>
<title>LifeBlog | Home </title>
</head>
<body>
<?php require_once 'includes/header.php' ?>
<div class="container">
<div class="content">
<h2 class="content-title">All articles in <?= getTopicNameById($topic_id);?></h2>
<?php
foreach ($posts as $post) : ?>
<div class="post">
<img src="<?= BASE_URL . 'static/images/' . $post["image"] ?>" alt="<?= $post["title"] ?>" class="post_image">
<?php if (isset($post['topic'][0]["name"])) : ?>
<?php endif;?>
<a href="single_post.php?post-slug=<?= $post["slug"] ?>">
<h3><?= $post["title"] ?></h3>
<div class="info">
<span class="date"><?= date('F j, Y', strtotime($post["created_at"])) ?></span>
<span class="read_more">Read more...</span>
</div>
</a>
</div>
<?php endforeach ?>
</div>
</div>
<?php require_once 'includes/footer.php' ?>
</body>
</html>