/** * Show Blog archives list * * @return void */ function show_blog_archives() { global $blogSettings; $Blog = new Blog(); $archives = $Blog->get_blog_archives(); if (!empty($archives)) { echo '<ul>'; foreach ($archives as $archive => $archive_data) { $post_count = $blogSettings['archivepostcount'] == 'Y' ? ' (' . $archive_data['count'] . ')' : ''; $url = $Blog->get_blog_url('archive') . $archive; echo "<li><a href=\"{$url}\">{$archive_data['title']} {$post_count}</a></li>"; } echo '</ul>'; } }
function show_blog_archives() { global $blogSettings; // Define GLOBAL variables $Blog = new Blog(); // Create a new instance of the Blog class $archives = $Blog->get_blog_archives(); // Get a list of archives. if (!empty($archives)) { // If we there are any archives in the list... foreach ($archives as $archive => $archive_data) { // For each archive in the list... // How many posts are there in this archive? $post_count = $blogSettings['archivepostcount'] == 'Y' ? ' (' . $archive_data['count'] . ')' : ''; $url = $Blog->get_blog_url('archive') . $archive; // What's the URL for this archive? echo "<li><a href=\"{$url}\">{$archive_data['title']} {$post_count}</a></li>"; // Ouput the HTML list item } } else { // We have no archives in the list echo i18n(BLOGFILE . '/NO_ARCHIVES'); // Let the user know } }
/** * bootstrap_get_blog_archives() * * This creates the HTML mark-up for the Blog Archives Widget in the * blog template sidebar. * This function supports the following plugins: * - GetSimple Blog v1.4 & v3.x * - GetSimple Blog v4.0+ * - NewsManager v2.0+ * * @return (string) : Echos the HTML mark-up */ function bootstrap_get_blog_archives() { if (function_exists('show_blog_archives')) { # GetSimple Blog v1.4 & v3.x $Blog = new Blog(); $arch = $Blog->get_blog_archives(); if (!empty($arch)) { foreach ($arch as $key => $item) { $url = $Blog->get_blog_url('archive') . $key; echo '<li class="list-group-item"><a href="' . $url . '">' . $item['title'] . '</a><span class="badge">' . $item['count'] . '</span></li>'; } } else { echo '<li class="list-group-item">Nothing in the Archive!<span class="badge">0</span></li>'; } } elseif (function_exists('gsblog_show_archives')) { # SimpleBlog v4.0+ gsblog_show_archives(); } elseif (function_exists('nm_blog_archives')) { # NewsManager v2.0+ nm_blog_archives(); } else { # No supported plugins found ?> <li class="list-group-item"> <span class="badge">0</span> No archives to show! </li> <?php } }