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.
With that out of the way, I shall begin.
One of the features I do like from WordPress is the known as The Loop.
while(have_posts()) : the_content();
the_content();
endwhile;
I’ve studied the code and come up with a similar class, which you can see here.
From looking at the code, I’ve figured out that, has_posts() seems to be returning a boolean if there are still posts in an array.
the_article is saying that we’re still in the loop, so set a variable for the articles(posts) with the data we need.
I’ve kind of got this working, however I only seem to be able to get one piece of information from the array:
while (have_articles()): the_article();
echo "<h1 class='title'>" . the_title() . "</h1>";
endwhile;
Where the_title is:
function the_title() {
global $AC;
return $AC->p_title;
}
Thanks for the help!
I changed
current_articleto apublicand not astaticvalue, which helped. It also turned out that my function,the_titlewas accessing the wrong field name.This problem is solved.
@Everyone who answered; your opinions are valued, and I agree, the loop is with its problems and stuff, but it also provides an easy (when you’re in control) way of causing content to how you want it, easily. See WordPress Themes.