How to include custom "blog archive"
Posted: Wed Dec 18, 2019 7:24 pm
Hi,
I've created my first theme under Bludit 3.1.0 and I'm struggling a bit with including a custom php file.
The issue:
I have a one-page template which has an own section showing the latest three blog posts.
Section code:
When clicking on the title, you are led to the full article. This is working fine.
Below the three latest posts I would like to add a "Show more" button, which is linked to a separate "archive.php" file that is listing all blog posts.
But how can I assign an own permalink to the archive.php and how can it be included by the "page.php" when clicking on the "Read more" button as shown on the main page?
I've created my first theme under Bludit 3.1.0 and I'm struggling a bit with including a custom php file.
The issue:
I have a one-page template which has an own section showing the latest three blog posts.
Section code:
Code: Select all
<!-- List Blog entries -->
<?php foreach ($content as $page): ?>
<a href="<?php echo $page->permalink(); ?>" class="col-lg-4 news-box">
<?php if ($page->coverImage()): ?>
<div class="image">
<img src="<?php echo $page->coverImage(); ?>" alt="">
</div>
<?php endif ?>
<?php if (!$page->isStatic() && !$url->notFound()): ?>
<!-- Creator information -->
<span class="news-info"><?php echo $page->user('nickname'); ?>, <?php echo $page->date(); ?></span>
<?php endif ?>
<!-- Title -->
<h2 class="title"><?php echo $page->title(); ?></h2>
</a>
<?php endforeach ?>
Below the three latest posts I would like to add a "Show more" button, which is linked to a separate "archive.php" file that is listing all blog posts.
But how can I assign an own permalink to the archive.php and how can it be included by the "page.php" when clicking on the "Read more" button as shown on the main page?