Last active
February 29, 2020 22:22
-
-
Save cblte/033dd6c5daf53f3ebec676b4eb9a72e2 to your computer and use it in GitHub Desktop.
Bludit - display amount of comments made for a post.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php foreach ($content as $page) : ?> | |
<!-- A single blog post on the homepage --> | |
<article <?php if ($page->custom('link')) {?>class="link" <?php } ?>> | |
<!-- | |
<?php | |
// CHECK IF PLUGIN IS LOADED | |
$pageUuid = $page->getValue('uuid'); | |
$commentCounter = 0; | |
foreach($SnickerIndex->db as $id => $comment) { | |
if($comment['page_uuid'] == $pageUuid) $commentCounter++; | |
} | |
if ($commentCounter == 0) { | |
$commentText = "Keine Kommentare"; | |
} elseif ($commentCounter = 1) { | |
$commentText = "1 Kommentar"; | |
} else { | |
$commentText = $commentCounter . "Kommentare"; | |
} | |
?> | |
--> | |
<!-- Load Bludit Plugins: Page Begin --> | |
<?php Theme::plugins('pageBegin'); ?> | |
<?php if ($page->coverImage()) : ?> | |
<img class="" alt="Cover Image for <?php echo $page->title(); ?>" src="<?php echo $page->coverImage(); ?>" /> | |
<?php endif ?> | |
<h2> | |
<?php if ($page->custom('link')) { ?> | |
<a href="<?php echo $page->custom('link'); ?>"><?php echo $page->title(); ?></a> | |
<span class="linkarrow">→</span> | |
<?php } else { ?> | |
<a href="<?php echo $page->permalink(); ?>"><?php echo $page->title(); ?></a> | |
<?php } ?> | |
</h2> | |
<small> | |
<a href="<?php echo $page->permalink(); ?>" title="Permalink: <?php echo $page->title(); ?>"><?php echo $page->date(); ?></a> | |
– | |
<?php echo $L->get('Reading time') . ': ' . $page->readingTime(); ?> | |
– | |
<a href="<?php echo $page->permalink(); ?>#comments"><?php echo $commentText ?></a> | |
</small> | |
<!-- Breaked content --> | |
<?php echo $page->contentBreak(); ?> | |
<?php if ($page->readMore()) : // Read more" button ?> | |
<a href="<?php echo $page->permalink(); ?>" title="Permalink: <?php echo $page->title(); ?>"><?php echo $L->get('Read more'); ?></a> | |
<?php endif ?> | |
<?php Theme::plugins('pageEnd'); // Load Bludit Plugins: Page End ?> | |
</article> | |
<hr /> | |
<?php endforeach; ?> | |
<!-- including pagination --> | |
<?php include(THEME_DIR_PHP . 'pagination.php'); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment