Newest blog post on top?


how do i have to modify the blog.php to get the newest blog posting on top of the blog page?

<?php snippet('header') ?>

	<main class="main" role="main">

  		<h1><?php echo html($page->title()) ?></h1>
		<?php echo kirbytext($page->text()) ?>

		<hr />

		<?php  $i = 0 ?>

		<?php foreach($page->children()->visible()->flip() as $article): ?>

		<?php $i++ ?>

		<?php if($i > 1) echo "<br />" ?>

    		<b><?php echo html($article->title()) ?></b>
    		<br /><br />
			<p><?php echo excerpt($article->text(), 300) ?></p>
			<a href="<?php echo $article->url() ?>"><?php echo l::get('more') ?></a>

		<?php endforeach ?>


<?php snippet('footer') ?>

ok, i just removed the ->flip() and now the newest entry is shown on top.

Nothing to do with your sort order, but may I suggest your use CSS to control the whitespace between your elements instead of using line breaks? Gives you much more control over your layout … And you would not need that the additional counter variable.

Hi Sonja,

thanks for your hint. Hope our other Layout thing will come to a decision soon. But i can tell you, that your offer is the preferred one.