Skip to content

Instantly share code, notes, and snippets.

@starckio
Forked from bastianallgeier/blog.php
Last active August 29, 2015 14:24
Show Gist options
  • Save starckio/f2c536cef4905a603d44 to your computer and use it in GitHub Desktop.
Save starckio/f2c536cef4905a603d44 to your computer and use it in GitHub Desktop.
<?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