Add Post Tag display

This commit is contained in:
Ben Goldsworthy 2021-01-09 10:35:19 +00:00
parent bb9dc6816e
commit 3c30f664b8
2 changed files with 42 additions and 15 deletions

View File

@ -320,7 +320,7 @@ html {
align-items: center;
grid-template-areas:
"post-content-header post-content"
" post-toc post-content"
" post-meta post-content"
" . post-content";
}
}
@ -378,25 +378,39 @@ html {
grid-area: post-date;
}
#split-page #post-toc {
grid-area: post-toc;
#split-page #post-meta {
grid-area: post-meta;
width: 100%;
text-align: left;
}
#split-page #post-toc > h1 {
#split-page #post-meta > h1 {
border-bottom: 2px inset var(--dark);
margin-top: 0.5em;
margin-bottom: 0.5em;
line-height: 1.2em;
text-align: center;
text-align: left;
}
#split-page #post-toc > ol > li {
#split-page #post-meta h2 {
margin-top: 0.5em;
font-size: 1.4em;
margin-bottom: 0.5em;
line-height: 1.2em;
text-align: left;
}
#split-page #post-meta > #post-contents > ol > li {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
#split-page #post-meta > #post-tags > a {
margin-top: 0.2em;
margin-left: 1em;
}
#split-page > #wrapper > .body {
grid-area: post-content;
display: block;

View File

@ -64,7 +64,7 @@
<li><?php echo $notes ?></li>
<?php endif; ?>
<?php if ($license = get_post_meta(get_the_ID(), 'License', true)): ?>
<li>This work is licensed under <?php echo $license ?>. <a href="https://bengoldsworthy.uk/2018/03/copywrong/">Sorry about that</a>.</li>
<li>This work is licensed under <?php echo $license ?>. <a href="/2018/03/copywrong/">Sorry about that</a>.</li>
<?php endif; ?>
</ul>
</div>
@ -79,15 +79,28 @@
?>
</main><!-- .entry-content -->
<footer id="post-toc">
<footer id="post-meta">
<h1>Post Meta</h1>
<?php if ($content = get_post_meta(get_the_ID(), 'ToC1', true)): ?>
<h1>Contents</h1>
<ol>
<?php $i = 1; ?>
<?php while($content = get_post_meta(get_the_ID(), 'ToC'.$i, true)): ?>
<li><a href="#section-<?php echo $i++ ?>"><?php echo $content ?></a></li>
<?php endwhile; ?>
</ol>
<section id="post-contents">
<h2>Contents</h2>
<ol>
<?php $i = 1; ?>
<?php while($content = get_post_meta(get_the_ID(), 'ToC'.$i, true)): ?>
<li><a href="#section-<?php echo $i++ ?>"><?php echo $content ?></a></li>
<?php endwhile; ?>
</ol>
</section>
<?php endif; ?>
<?php if ($tags = get_the_tags(get_the_ID())): ?>
<section id="post-tags">
<h2>Tags</h2>
<?php foreach ($tags as $tag): ?>
<a href="<?php echo get_tag_link($tag->term_id) ?>" title="<?php echo $tag->name ?> Tag" class="tag-link">
<?php echo $tag->name ?>
</a>
<?php endforeach; ?>
</section>
<?php endif; ?>
</footer>
</article><!-- #post-## -->