Skip to content

Commit a9ef666

Browse files
fix: adjust widget formatting
- use title block for h1 elements to consistently position sidebar - add documentation for widgets - adjust positioning for 404 page and other pages where flex-sibling doesn't occupy full width
1 parent 9978fc9 commit a9ef666

File tree

10 files changed

+31
-22
lines changed

10 files changed

+31
-22
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ By default, comments are turned off for pages, but can be enabled for pages indi
210210
1. Access the Page settings menu on the right side of the page
211211
1. Scroll down the menu to the option with the heading "Disucssion", check "Allow comments", and update the page
212212

213+
### Widgets
214+
215+
A footer widget area and a sidebar widget area (which appears below content on smaller screens) are built into the theme. Widgets can be added to these areas by navigating to Appearance > Widgets from the admin dashboard. Navigating to the widgets admin page will automatically fill the sidebar widget area with default content. Blocks can be added, edited, or removed here. If you wish to deactivate widgets but keep them available for later, widgets can be dragged and dropped into the Inactive widgets area. This is easiest done from the List View, which can be accessed via the button on the top left side of the page.
216+
213217
### Template Hierarchy
214218

215219
This starter template covers the generic templates needed for things like single post pages, archive (or listing) pages, the 404 page, and the search page, but you can override those using [WordPress' template hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/).

src/php/index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
$templates = array( 'index.twig' );
2525
if ( is_home() && ! is_front_page() ) {
2626
$context['title'] = single_post_title();
27+
} elseif ( ! $context['posts']->found_posts ) {
28+
$context['title'] = 'Nothing Found';
2729
} else {
2830
$context['title'] = 'Recent Posts';
2931
}

src/php/views/404.twig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{% extends "layouts/base.twig" %}
22

3+
{% block title %}
4+
<h1>Nothing Found</h1>
5+
{% endblock %}
6+
37
{% block content %}
4-
<div class="obj-width-limiter">
5-
{% include 'partials/content-none.twig' %}
6-
</div>
8+
{% include 'partials/content-none.twig' %}
79
{% endblock %}

src/php/views/index.twig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{% extends "layouts/base.twig" %}
22

3+
{% block title %}
4+
<h1>{{ title }}</h1>
5+
{% endblock %}
6+
37
{% block content %}
4-
<div class="obj-width-limiter">
8+
<div>
59
{% if posts.found_posts %}
610

711
{# new block that can be overwritten #}
812
{% block posts_found %}
9-
<h1>{{ title }}</h1>
1013
{% for post in posts %}
1114
{% include 'partials/content-single.twig' with {post: post} %}
1215
{% endfor %}

src/php/views/layouts/base.twig

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,24 @@
1414

1515
<main id="main">
1616
<article id="post-{{ post.id }}" class="post-type-{{ post.post_type }} {{ function('get_post_class')|join(' ') }}">
17-
{% if post.title %}
18-
<div class="obj-width-limiter">
19-
<h1>{{ post.title }}</h1>
20-
</div>
21-
{% endif %}
2217

23-
<div class="cmp-post-body">
18+
<div class="obj-width-limiter">
19+
{% block title %}
20+
{% if post.title %}
21+
<h1>{{ post.title }}</h1>
22+
{% endif %}
23+
{% endblock %}
24+
</div>
25+
26+
<div class="cmp-post-body obj-width-limiter">
2427
{# content block from child templates #}
2528
{% block content %}
26-
<div class="obj-width-limiter">
29+
<div>
2730
Sorry, no content
2831
</div>
2932
{% endblock %}
3033
{% if sidebar_widget %}
31-
<aside class="obj-width-limiter cmp-primary-sidebar">
34+
<aside class="cmp-primary-sidebar">
3235
{{ sidebar_widget }}
3336
</aside>
3437
{% endif %}

src/php/views/page.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends "layouts/base.twig" %}
22

33
{% block content %}
4-
<div class="obj-width-limiter">
4+
<div>
55
<img
66
src="{{ post.thumbnail.src|resize(960) }}"
77
{% if post.thumbnail.alt and post.thumbnail.alt|length > 0 %}

src/php/views/partials/content-none.twig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
<section>
2-
<header>
3-
<h1>Nothing Found</h1>
4-
</header>
5-
62
<div>
73
{{ function('get_search_form') }}
84
</div>

src/php/views/search.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{% extends "index.twig" %}
22

33
{% block posts_found %}
4-
<h1>{{ title }}</h1>
54
{% for post in posts %}
65
{% include 'partials/content-search.twig' with {post: post} %}
76
{% endfor %}

src/php/views/single-password.twig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{% extends "layouts/base.twig" %}
22

33
{% block content %}
4-
<div class="obj-width-limiter">
5-
{{ function('get_the_password_form') }}
6-
</div>
4+
{{ function('get_the_password_form') }}
75
{% endblock %}

src/scss/components/_primary-sidebar.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
padding: 1rem;
44

55
@media (min-width: 50rem) {
6+
margin-inline-start: auto;
67
flex-basis: 18.75rem;
8+
flex-shrink: 0;
79
}
810
}

0 commit comments

Comments
 (0)