Registry::set('rwar_post_archive', false); } return $result; } ?> <!-- This is the HTML portion, it might go within a <body> tag or whatever --> <?php while (post_list()) { ?> <?php foreach ($displayCats as $cat) { ?> <?php if (article_category_id() == $cat) { ?> <!-- Here Goes Whatever your want each item to display. I currently use list items but you could forseeably use divs, table items, or flexbox children. <li> <a href="<?php echo article_url(); ?> "><h1><?php echo article_title(); ?> </h1></a> <p><?php echo article_description(); ?> </p> </li>
/** * Get the url to an adjacent article * @param number of articles desired * @return object array */ function related_posts($n) { $posts = Post::get(Base::table('posts'), '=', 'published'); $postarr = array(); foreach ($posts as $post) { if ($post->id != article_id()) { if ($post->category == article_category_id()) { array_push($postarr, $post); } } } shuffle($postarr); $postarr = array_slice($postarr, 0, $n); return $postarr; }