I'm having trouble displaying all posts within a category.
Most of my file is copied from the theme help and inspiration from the built-in themes.
In my index.php, I have this bit to check where we are:
Code: Select all
if ($Url->whereAmI()=='home') {
foreach ($pages as $Page) {
echo "<h3 class='entry-title'>".$Page->title()."</h3>";
echo "<div class='entry-content'>".$Page->content()."</div>";
}
}
elseif ($Url->whereAmI()=='page') {
echo "<h3 class='entry-title'>".$Page->title()."</h3>";
echo "<div class='entry-content'>".$Page->content()."</div>";
}
elseif ($Url->whereAmI()=='category') {
foreach ($pages as $page) {
echo "<h3 class='entry-title'>".$Page->title()."</h3>";
echo "<div class='entry-content'>".$Page->content()."</div>";
}
The second check for "page" isn't used at the moment.
The last check doesn't work correctly. I have assigned my post with a category, and when clicking a link to a certain category, I'd like to display all posts within that particular category.
I'm certain it has something to do with the
Code: Select all
foreach ($pages as $page)
Any tips as to how I can alter the foreach loop so it displays all posts within a specific category?
I should say I'm a php rookie. (if you are in doubt by now). I've messed about with php and Wordpress some 10 years ago, but the world was a different place then.
Version 2.0.2 by the way - and thanks for any help!