function posts() { if (has_posts() === false) { return false; } $posts = IoC::resolve('posts'); if ($result = $posts->valid()) { // register single post IoC::instance('article', $posts->current(), true); // move to next $posts->next(); } return $result; }
/** * Returns true if there is at least one tagged post * This replaces the Anchor has_posts() method * * @return bool */ function has_tagged_posts() { if (isset($_GET) && array_key_exists('tag', $_GET) && ($tag = $_GET['tag'])) { if ($tagged_posts = get_posts_with_tag($tag)) { $count = Post::where_in('id', $tagged_posts)->where('status', '=', 'published')->count(); } else { $count = 0; } Registry::set('total_tagged_posts', $count); } else { Registry::set('total_tagged_posts', 0); return has_posts(); } return Registry::get('total_tagged_posts', 0) > 0; }
?> <div class="container"> <div class="col-md-8"> <div class="panel panel-default"> <div class="panel-body"> <h1>Recent Posts:</h1> <hr> <?php if (has_posts()) { ?> <ul style="list-style-type: none;"> <?php posts(); ?> <li> <article class="wrap"> <h1> <a href="<?php echo article_url(); ?> " title="<?php echo article_title(); ?> "><?php
/** * Returns true if there is at least one tagged post * This replaces the Anchor has_posts() method * * @return bool */ function has_tagged_posts() { $tag = extract_tag(); if ($tag != '') { if ($tagged_posts = get_posts_with_tag($tag)) { $count = Post::where_in('id', $tagged_posts)->where('status', '=', 'published')->count(); } else { $count = 0; } Registry::set('total_tagged_posts', $count); } else { Registry::set('total_tagged_posts', 0); return has_posts(); } return Registry::get('total_tagged_posts', 0) > 0; }
get_header(); ?> <div class="container blog"> <div class="page-container"> <?php if (!have_posts()) { ?> Sorry, no results were found. <?php } ?> <?php while (has_posts()) { the_post(); ?> <article> <h3><a href="<?php echo get_permalink(); ?> "><?php the_title(); ?> </a></h3> <div class="rte"> <?php the_content(); ?> </div>
<div class="medium-12 columns"> <h1><?php echo site_name(); ?> </h1> <p><?php echo site_description(); ?> </p> </div> </div> </section> <section class="posts content"> <?php if (!has_posts()) { ?> <div class="row"> <div class="medium-12 columns"> <h2>No posts</h2> <p>There's no posts here.</p> </div> </div> <?php } else { ?> <?php while (posts()) { ?> <?php theme_include('list_article');