title: PHP Re-create Wordpress the_loop
body: <p>I'm currently working on a basic, but bespoke CMS that we will be using across several of our sites. Before anyone flames me, I am well aware of other alternatives, however nothing we have tried is really flexible enough for our data.</p>
  
  <p>With that out of the way, I shall begin.</p>
  
  <p>One of the features I do like from Wordpress is the known as The Loop.</p>
  
  <pre><code>while(have_posts()) : the_content();
      the_content();
  endwhile;
  </code></pre>
  
  <p>I've studied the code and come up with a similar class, which you can see <a href="https://gist.github.com/86ca87b92c56b2cd7221" rel="nofollow">here</a>.</p>
  
  <p>From looking at the code, I've figured out that, <code>has_posts()</code> seems to be returning a boolean if there are still posts in an array.</p>
  
  <p><code>the_article</code> is saying that we're still in the loop, so set a variable for the articles(posts) with the data we need.</p>
  
  <p>I've kind of got this working, however I only seem to be able to get one piece of information from the array:</p>
  
  <pre><code>while (have_articles()): the_article();
      echo "&lt;h1 class='title'&gt;" . the_title() . "&lt;/h1&gt;";
  endwhile;
  </code></pre>
  
  <p>Where <code>the_title</code> is:</p>
  
  <pre><code>function the_title() {
      global $AC;
  
      return $AC-&gt;p_title;
  }
  </code></pre>
  
  <p>Thanks for the help!</p>