From e8f563b1965598ed732a1de6a906e2f6bce4eef2 Mon Sep 17 00:00:00 2001 From: Dan Head Date: Sun, 6 Jan 2019 13:29:25 +0000 Subject: [PATCH] Inital layout of home page --- css/excerpt.css | 11 ++++++ css/page.css | 16 +++++++- css/title.css | 2 + theme/404.php | 6 +-- theme/front-page.php | 42 ++++++++++++++++++++ theme/page-archive.php | 16 ++++---- theme/page.php | 13 +++---- theme/partials/excerpt.php | 42 ++++++++++++++++++++ theme/partials/pagination.php | 2 + theme/search.php | 73 ++++++++++++----------------------- theme/single.php | 10 ++--- theme/tag.php | 22 +++++------ 12 files changed, 167 insertions(+), 88 deletions(-) create mode 100644 theme/front-page.php create mode 100644 theme/partials/excerpt.php diff --git a/css/excerpt.css b/css/excerpt.css index 2d88193..07f2ec8 100644 --- a/css/excerpt.css +++ b/css/excerpt.css @@ -1,10 +1,13 @@ .excerpt { + border-bottom: 1px solid var(--color-light-grey); margin-bottom: var(--space-sm); + padding-bottom: var(--space-sm); } @media (--viewport-md) { .excerpt { margin-bottom: var(--space-md); + padding-bottom: var(--space-md); } } @@ -14,6 +17,14 @@ margin-bottom: var(--space-xs); } +@media (--viewport-md) { + .excerpt__head, + .excerpt__body, + .excerpt__title { + margin-bottom: var(--space-sm); + } +} + .excerpt__metadata { color: var(--color-grey); font-size: 12px; diff --git a/css/page.css b/css/page.css index 1c21d60..5b024dd 100644 --- a/css/page.css +++ b/css/page.css @@ -83,7 +83,21 @@ @media (--viewport-xl) { .page { - grid-template-columns: 224px 1fr 1fr; + grid-template-columns: 224px 1fr; grid-template-rows: 32px 162px 1fr; } + + .page__content--2col { + display: grid; + grid-template-columns: 1fr 1fr; + grid-gap: var(--space-md); + } + + .page__content-item { + display: flex; + } + + .page__content-item--full-width { + grid-column: 1 / -1; + } } diff --git a/css/title.css b/css/title.css index b0902d7..d3d7205 100644 --- a/css/title.css +++ b/css/title.css @@ -1,11 +1,13 @@ .title { font-family: var(--heading-font-family); + font-size: 1.8rem; color: var(--color-dark-blue); margin-bottom: var(--space-sm); } @media (--viewport-md) { .title { + font-size: 2.4rem; margin-bottom: var(--space-md); } } diff --git a/theme/404.php b/theme/404.php index b8371e7..7ee1783 100644 --- a/theme/404.php +++ b/theme/404.php @@ -4,10 +4,8 @@
-
-

404 - Page not found

- Go back home -
+

404 - Page not found

+ Go back home
diff --git a/theme/front-page.php b/theme/front-page.php new file mode 100644 index 0000000..ffe63aa --- /dev/null +++ b/theme/front-page.php @@ -0,0 +1,42 @@ + +
+ +
+
+

Latest articles

+
+ 4, + )); + foreach ($posts as $post) { + $date = strtotime($post->post_date); + $year = date('Y', $date); + $month = date('F', $date); + $day = date('jS', $date); + $date = get_the_date('jS F, Y', $post->ID).' at '.get_the_date('H:i', $post->ID); + $excerpt = array( + title => $post->post_title, + url => get_permalink($post->ID), + content => $post->post_excerpt, + author => get_the_author_meta('nickname', $post->post_author), + comments => $post->comment_count, + date => $date, + ); + echo '
'; + get_template_part('partials/excerpt'); + echo '
'; + } + ?> +
+
+ +
+ +
+ + diff --git a/theme/page-archive.php b/theme/page-archive.php index 6918768..af1e058 100644 --- a/theme/page-archive.php +++ b/theme/page-archive.php @@ -4,17 +4,15 @@
+

+ + + +

-

- - - -

-
- -
- +
+
diff --git a/theme/page.php b/theme/page.php index 35766e6..d4170d7 100644 --- a/theme/page.php +++ b/theme/page.php @@ -5,21 +5,18 @@
+

+ +

-

- -

-
-
-

Sorry, there is no article to display

- Go back home -
+

Sorry, there is no article to display

+ Go back home
diff --git a/theme/partials/excerpt.php b/theme/partials/excerpt.php new file mode 100644 index 0000000..b7112dc --- /dev/null +++ b/theme/partials/excerpt.php @@ -0,0 +1,42 @@ + +
+
+
+ + + +
+
+
+ +
+
+ +
+
diff --git a/theme/partials/pagination.php b/theme/partials/pagination.php index a1cf101..dad11ab 100644 --- a/theme/partials/pagination.php +++ b/theme/partials/pagination.php @@ -40,6 +40,7 @@ function format_link($link) { return $link; } +if (count($links) > 1) : ?> + diff --git a/theme/search.php b/theme/search.php index a4a0e17..2e6b2d8 100644 --- a/theme/search.php +++ b/theme/search.php @@ -1,68 +1,45 @@ found_posts; ?>
-
+ +

Sorry, no results found.

+ Go back home +

found_posts.' results matching "' . $query . '" found.'; + echo $results.' result'.($results !== '1' ? 's' : '').' matching "' . $query . '" found.'; ?>

-
    - - - -
  1. -
    -
    -
    - - - -
    -
    -
    - -
    -
    - -
    -
    -
  2. - -
-
+ +
    + +
  1. + get_the_title(), + url => get_the_permalink(), + content => get_the_excerpt(), + author => get_the_author_meta('nickname'), + comments => get_comments_number(), + date => get_the_date('jS F, Y', $id) . ' at ' . get_the_date('H:i', $id), + ); + get_template_part('partials/excerpt') + ?> +
  2. + +
- -
-
-

Sorry, no results found.

- Go back home -
-
-
diff --git a/theme/single.php b/theme/single.php index 07aa7ed..405ddb7 100644 --- a/theme/single.php +++ b/theme/single.php @@ -32,13 +32,9 @@
-
-
-

Sorry, there is no article to display

-
- Go back home -
-
+
+

Sorry, there is no article to display

+ Go back home
diff --git a/theme/tag.php b/theme/tag.php index 9cf0f93..aff4cc6 100644 --- a/theme/tag.php +++ b/theme/tag.php @@ -4,17 +4,17 @@
+

+ + + + + + +

-

- - - - - - -

    @@ -58,8 +58,8 @@
+

Sorry, no results found.

-

Sorry, no results found.

Go back home