Skip to content

Instantly share code, notes, and snippets.

@cblte
Last active February 29, 2020 22:22
Show Gist options
  • Save cblte/033dd6c5daf53f3ebec676b4eb9a72e2 to your computer and use it in GitHub Desktop.
Save cblte/033dd6c5daf53f3ebec676b4eb9a72e2 to your computer and use it in GitHub Desktop.
Bludit - display amount of comments made for a post.
<?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>
&ndash;
<?php echo $L->get('Reading time') . ': ' . $page->readingTime(); ?>
&ndash;
<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