I've been trying to find a solution on how to sort the blog posts of my website from newest to oldest. The blog couldn't be found in the data base as I think it was created independently.
Here's the code in the backend:
Code: Select all
<?php
//print '<pre>'.print_r($content_list, true).'</pre>';
print '<ul class="blog-list">';
foreach ($content_list as $blog_entry){
print '<li>';
print '<div class="blog-image"><a href="blog.php?cname='.$blog_entry['name'].'" title="'.$blog_entry['title'].'">'.$blog_entry['image'].'</a></div>';
print '<h3 class="blog-title"><a href="blog.php?cname='.$blog_entry['name'].'" title="'.$blog_entry['title'].'">'.$blog_entry['title'].'</a></h3>';
print '<span class="blog-date">'.date('F d, Y', strtotime($blog_entry['date'])).'</span>';
print '</li>';
}
?>
<?php } else { ?>