Skip to content

Instantly share code, notes, and snippets.

@starckio

starckio/blog.php

Forked from bastianallgeier/blog.php
Last active Aug 29, 2015
Embed
What would you like to do?
<?php
$blogs = $pages->findByUID('blog1', 'blog2');
$articles = $blogs->children()->sortBy('date', 'desc');
// if you want you can add a limit or pagination to that set of articles
// afterwards just use a regular foreach loop to go through them all.
?>
<?php foreach($articles as $article): ?>
<article>
<?php if($article->template() == 'article.text'): ?>
<!-- put the HTML for the text post here -->
<?php elseif($article->template() == 'article.video'): ?>
<!-- put the HTML for the video post here -->
<?php elseif($article->template() == 'article.image'): ?>
<!-- put the HTML for the image post here -->
<?php elseif($article->template() == 'article.link'): ?>
<!-- put the HTML for the link post here -->
<?php elseif($article->template() == 'article.quote'): ?>
<!-- put the HTML for the quote post here -->
<?php endif ?>
</article>
<?php endforeach ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment