From 2ac3f742b57acf6302e711be6f2022adc6940b86 Mon Sep 17 00:00:00 2001 From: Adam Piontek <adam@73k.us> Date: Sat, 10 Jul 2021 10:42:28 -0400 Subject: [PATCH] add main posts pagination, fix tag links --- content-templates/content-article.php | 7 +++---- index.php | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/content-templates/content-article.php b/content-templates/content-article.php index e1a2900..a6e7610 100644 --- a/content-templates/content-article.php +++ b/content-templates/content-article.php @@ -32,12 +32,11 @@ namespace WP_73k; <?php if (has_tag()) { - echo '<div class="post-tags fs-smaller mb-4">' . svg_icon_use("mdi-tag-multiple", "icon baseline text-gray-300 me-1"); + echo '<div class="post-tags fs-smaller mb-4">'; + echo svg_icon_use("mdi-tag-multiple", "icon baseline text-gray-300 me-1"); $tag_strings = array_map(function ($tag) { - $tag_str = '<span class="text-gray-300">#</span>'; - $tag_str .= '<a href="' . get_bloginfo('url') . '/tag/' . $tag->slug . '">' . $tag->name . '</a>'; - return $tag_str; + return '<span class="text-gray-300">#</span><a href="' . get_tag_link($tag) . '">' . $tag->name . '</a>'; }, get_the_tags()); echo implode(", ", $tag_strings) . '</div>'; diff --git a/index.php b/index.php index 7350012..f6a0e03 100644 --- a/index.php +++ b/index.php @@ -18,6 +18,14 @@ get_header(); ?> the_post(); echo get_template_part( 'content-templates/content', 'article' ); } + ?> + + <nav class="d-flex justify-content-between" aria-label="Page navigation"> + <div class="nav-previous alignleft"><?php next_posts_link( '← Older' ); ?></div> + <div class="nav-next alignright"><?php previous_posts_link( 'Newer →' ); ?></div> + </nav> + + <?php } ?>