Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
error_reporting(E_ALL);
ini_set('display_errors','1');
require_once('includes/class-query.php');
if (!empty($_GET)) {
if(!empty($_GET['p'])){
$post = $_GET['p'];
}
if(!empty($_GET['cat'])){
$cat = $_GET['cat'];
}
}
if( empty($post) && empty($cat)) {
$posts_array = $query->all_posts();
}
elseif(!empty($post)) {
$posts_array = $query->post($post);
}
elseif(!empty($cat)) {
echo "category";
}
?>
<html>
<head>
<title>Home</title>
<link rel="stylesheet" href="css/main.css" type="text/css">
</head>
<body>
<!--nav-->
<nav>
<div>
<ul>
<li>
<a href="home.php">Home</a>
</li>
<li>
<a href="admin/post_edit.php">Add Post</a>
</li>
</ul>
</div>
</nav>
<!--header-->
<header class="home-header">
<h1>home</h1>
</header>
<!--post-->
<div class="posts-body">
<div class="posts-container">
<?php foreach($posts_array as $post): ?>
<div class="post">
<h2><a href="?p=<?php echo $post->id; ?>"><?php echo $post->post_title; ?></a></h2>
<p><?php echo $post->post_content; ?></p>
</div>
<?php endforeach; ?>
</div>
</div>
</body>
</html>