forked from kostyakoz/write
/
posts.php
executable file
·26 lines (26 loc) · 1.38 KB
/
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
<?php theme_include('header'); ?>
<section id="main">
<?php if(has_posts()): ?>
<?php $i = 0; while(posts()): ?>
<?php $bg = sprintf('background: hsl(215, 28%%, %d%%);', round(((++$i / posts_per_page()) * 20) + 20)); ?>
<?php echo $i > 1 ? "<hr>" : ''; ?>
<article>
<h2><a href="<?php echo article_url(); ?>"><?php echo article_title(); ?></a></h2>
<p class="small-title">Written <time title="<?php echo date('Y-m-d H:i:s', article_time());?>" datetime="<?php echo date(DATE_W3C, article_time()); ?>"><?php echo relative_time(article_time()); ?></time> by <?php echo article_author('real_name'); ?> in <a href="<?php echo article_category_url(); ?>"><?php echo article_category(); ?></a>.</p>
<div><?php echo article_markdown();?></div>
</article>
<?php endwhile; ?>
<?php if(has_pagination()): ?>
<hr class="spacing">
<section id="pagination" class="clearfix">
<nav>
<item style="float:left;"><?php echo posts_next('← Newer'); ?></item>
<item style="float:right;"><?php echo posts_prev('Older →'); ?></item>
</nav>
</section>
<?php endif; ?>
<?php else: ?>
<p>Looks like you have some writing to do!</p>
<?php endif; ?>
</section>
<?php theme_include('footer'); ?>