From cd62a1df2301d9359a0aefb625a2d1f4d6f44102 Mon Sep 17 00:00:00 2001 From: Dan Head Date: Wed, 12 Dec 2018 13:51:00 +0000 Subject: [PATCH] Archive page, with list of all posts --- css/archive.css | 19 ++++++++++++ css/article.css | 24 ++++----------- css/content.css | 6 ++++ css/index.css | 3 ++ css/page.css | 1 + css/title.css | 16 ++++++++++ theme/header.php | 2 +- theme/index.php | 10 +++--- theme/page-archive.php | 25 +++++++++++++++ theme/page.php | 10 +++--- theme/partials/archive.php | 62 ++++++++++++++++++++++++++++++++++++++ theme/single.php | 6 ++-- 12 files changed, 152 insertions(+), 32 deletions(-) create mode 100644 css/archive.css create mode 100644 css/content.css create mode 100644 css/title.css create mode 100644 theme/page-archive.php create mode 100644 theme/partials/archive.php diff --git a/css/archive.css b/css/archive.css new file mode 100644 index 0000000..b760675 --- /dev/null +++ b/css/archive.css @@ -0,0 +1,19 @@ +.archive__list { + margin-bottom: var(--space-sm); +} + +.archive__list--sub-list { + margin-left: var(--space-sm); +} + +.archive__heading { + font-family: var(--heading-font-family); + color: var(--color-dark-blue); + margin-bottom: var(--space-xs); +} + +.archive__date { + display: inline-block; + font-style: italic; + min-width: 40px; +} diff --git a/css/article.css b/css/article.css index fa584d8..ab704c5 100644 --- a/css/article.css +++ b/css/article.css @@ -4,22 +4,6 @@ } } -.article__title { - font-family: var(--heading-font-family); - color: var(--color-dark-blue); - margin-bottom: var(--space-sm); -} - -.article__title a { - color: inherit; -} - -@media (--viewport-lg) { - .article__title { - margin-bottom: var(--space-md); - } -} - .article__date { color: var(--color-grey); margin-bottom: var(--space-sm); @@ -81,12 +65,12 @@ * List styles */ -.article__content li { +.article__content ul li { position: relative; padding: 0 0 var(--space-xs) var(--space-sm); } -.article__content li:before { +.article__content ul li:before { content: ''; position: absolute; left: 4px; @@ -214,3 +198,7 @@ .article th { border-width: 0 0 2px; } + +.article iframe { + max-width: 100%; +} diff --git a/css/content.css b/css/content.css new file mode 100644 index 0000000..b9e321c --- /dev/null +++ b/css/content.css @@ -0,0 +1,6 @@ +.content { + border-bottom: 1px solid var(--color-light-grey); + margin-bottom: var(--space-md); + padding-bottom: var(--space-md); +} + diff --git a/css/index.css b/css/index.css index d408587..32f761e 100644 --- a/css/index.css +++ b/css/index.css @@ -9,6 +9,7 @@ @import "metadata"; @import "search"; @import "article"; +@import "content"; @import "footer"; @import "comments"; @import "comment"; @@ -16,6 +17,8 @@ @import "avatar"; @import "link"; @import "pagination"; +@import "title"; +@import "archive"; :root { --color-black: #000; diff --git a/css/page.css b/css/page.css index 7995651..7a6ee91 100644 --- a/css/page.css +++ b/css/page.css @@ -42,6 +42,7 @@ grid-row-start: 1; } + .page__content, .page__article { grid-column-start: 2; grid-row: span 2; diff --git a/css/title.css b/css/title.css new file mode 100644 index 0000000..4b61d23 --- /dev/null +++ b/css/title.css @@ -0,0 +1,16 @@ +.title { + font-family: var(--heading-font-family); + color: var(--color-dark-blue); + margin-bottom: var(--space-sm); +} + +.title a { + color: inherit; +} + +@media (--viewport-lg) { + .title { + margin-bottom: var(--space-md); + } +} + diff --git a/theme/header.php b/theme/header.php index 60d9eef..44e1174 100644 --- a/theme/header.php +++ b/theme/header.php @@ -2,7 +2,7 @@ > - <?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' by'; } ?> <?php bloginfo('name'); ?> + <?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' « '; } ?> <?php bloginfo('name'); ?> diff --git a/theme/index.php b/theme/index.php index 5a44bb0..e1ad4e2 100644 --- a/theme/index.php +++ b/theme/index.php @@ -14,12 +14,12 @@ -

- - - -

+

+ + + +

»', 'windycoys')); ?>
diff --git a/theme/page-archive.php b/theme/page-archive.php new file mode 100644 index 0000000..9167e11 --- /dev/null +++ b/theme/page-archive.php @@ -0,0 +1,25 @@ + +
+ +
+
+

+ + + +

+ + +
+
+
+ +
+ +
+ + diff --git a/theme/page.php b/theme/page.php index a30420f..ac48fc8 100644 --- a/theme/page.php +++ b/theme/page.php @@ -6,12 +6,12 @@
diff --git a/theme/partials/archive.php b/theme/partials/archive.php new file mode 100644 index 0000000..c2ccdf4 --- /dev/null +++ b/theme/partials/archive.php @@ -0,0 +1,62 @@ + -1, + order => 'ASC', +)); +$archive = array(); + +foreach ($posts as $post) { + $date = strtotime($post->post_date); + $year = date('Y', $date); + $month = date('F', $date); + $day = date('jS', $date); + $url = get_permalink($post->ID); + $comments = $post->comment_count === '1' ? '1 comment' : $post->comment_count . ' comments'; + if ($post->post_status === 'publish') { + $archive[$year][$month][] = array( + title => $post->post_title, + slug => $post->post_name, + author => $post->post_author, + day => $day, + url => $url, + comments => $comments, + ); + } +} + +?> +
+
    + $yearData) : ?> +
  1. +

    + +

    +
      + $monthData) : ?> +
    1. +

      + +

      +
        + +
      1. + + + + + + + + () + +
      2. + +
      +
    2. + +
    +
  2. + +
+
diff --git a/theme/single.php b/theme/single.php index 6882ada..fe60f49 100644 --- a/theme/single.php +++ b/theme/single.php @@ -14,10 +14,10 @@ -

- -

+

+ +

»', 'windycoys')); ?>