Exemple #1
0
	</section>

	<section class='padded-left col-sm-8'>
		<header>
			<h2 class='pull-left'>
				Blog
			</h2>
			<a href="<?php 
echo bloginfo('url');
?>
/blog" class='pull-right'>All Blog Entries</a>
			<div class='clearfix'></div>
		</header>
		<ul class='tiles list-unstyled border-bottom'>
			<?php 
$blogPosts = getBlogPosts(3);
?>
			<?php 
if ($blogPosts->have_posts()) {
    while ($blogPosts->have_posts()) {
        $blogPosts->the_post();
        ?>
			<li>
				<span class='state-indicator'></span>
				<h3>
					<a href="<?php 
        echo get_permalink();
        ?>
"><?php 
        the_title();
        ?>
Exemple #2
0
        // is there any error?
        exit("MySQL reports " . $db->error);
    }
    $posts = array();
    while ($row = mysqli_fetch_assoc($result)) {
        $id = $row["id"];
        $title = $row["title"];
        $header_title = $row["header_title"];
        $start_date = $row["start_date"];
        $end_date = $row["end_date"];
        $text = $row["text"];
        $sidebar = $row["sidebar"];
        array_push($posts, array($id, $title, $header_title, $start_date, $end_date, $text, $sidebar));
    }
    $db->close();
    // close connection
    echo json_encode($posts);
}
/************************************************************
	HTTP GET REQUESTS
	************************************************************/
$cmd = $_GET['cmd'];
if (!empty($_GET["cmd"])) {
    switch ($cmd) {
        case "get_blog_posts":
            echo getBlogPosts();
            break;
        default:
            echo $cmd;
    }
}
Exemple #3
0
    $blog['title'] = 'Recent Posts | Blog' . ($blog['page'] != 1 ? ' | Page ' . $blog['page'] : '');
    $blog['currentPage'] = 'blog';
    $blog['description'] = "The most recent posts that Fisher Evans has made to his Blog.";
    return $app->render('views/blog/postList.php with views/layout.php', $blog);
});
$app->bind("/blog/tag/:slug", function ($params) use($app) {
    $this->reroute("/blog/tag/" . $params["slug"] . "/1");
});
$app->bind("/blog/tag/:slug/:page", function ($params) use($app) {
    $tag = collection('Tags')->findOne(['name_slug' => $params['slug']]);
    $tagIds = [$tag['_id']];
    if (!isset($tag)) {
        return get404("Looks like that tag doesn't exist. Whoops.");
    }
    $blog = getBlogPosts(function ($post) use($tagIds) {
        return count(array_intersect($tagIds, $post['tags'])) === count($tagIds) && isset($post['published']) && $post['published'] == true;
    }, $params['page']);
    if ($blog == null) {
        return get404();
    }
    $blog['title'] = $tag['name'] . ' | Blog' . ($blog['page'] != 1 ? ' | Page ' . $blog['page'] : '');
    $blog['description'] = "The most recent posts tagged under " . $tag['name'] . " that Fisher Evans has made to his Blog.";
    $blog['currentPage'] = 'blog';
    $blog['filterTag'] = $tag;
    return $app->render('views/blog/postList.php with views/layout.php', $blog);
});
$app->bind("/blog/post/:slug", function ($params) use($app) {
    $post = collection('Blog Posts')->findOne(["title_slug" => $params['slug']]);
    if (!isset($post) || $post['published'] == false) {
        return get404();
    }