├── .github
└── workflows
│ ├── deploy-to-production.yml
│ └── deploy-to-staging.yml
├── README.md
├── acf-json
├── group_60b5f41d4f46f.json
└── group_60b609db674d3.json
├── assets
├── css
│ └── selectr.css
└── js
│ ├── intensity-toggle.js
│ └── selectr.js
├── fonts
├── Rubik-Bold-Extra.woff2
├── Rubik-Bold.ttf
└── Rubik-Bold.woff2
├── footer.php
├── functions.php
├── header.php
├── images
├── AE_AwardforDigitalHumanity2021.png
├── Branch_power_logo_blue.svg
├── Branch_power_logo_green.svg
├── Branch_power_logo_orange.svg
├── Branch_text_logo.svg
├── Climate_Action_Tech_Logo.svg
├── Contents_icon.svg
├── Works_offline_symbol.svg
├── branch-power-logo-green.svg
├── branch_black-01.svg
├── branch_blue-01.svg
├── branch_blue-02.svg
├── branch_green-01.svg
├── branch_green-02.svg
├── branch_orange-01.svg
├── branch_orange-02.svg
├── branch_red-01.svg
├── energy.svg
└── solid-placeholder.php
├── inc
├── contents-sidebar.php
├── custom-header.php
├── custom-posts-and-taxonomies.php
├── customizer.php
├── jetpack.php
├── rewrite_rules.php
├── template-functions.php
└── template-tags.php
├── index.php
├── js
└── gridintensity.browser.min.js
├── sidebar.php
├── style.css
├── taxonomy-issue.php
└── template-parts
├── carbon-switcher
└── carbon-switcher.php
├── content-none.php
├── content-page.php
├── content-post.php
├── content-search.php
└── content.php
/.github/workflows/deploy-to-production.yml:
--------------------------------------------------------------------------------
1 | name: Deploy to production
2 |
3 | on:
4 | push:
5 | branches: [ production ]
6 |
7 | jobs:
8 | build:
9 |
10 | runs-on: ubuntu-20.04
11 |
12 | steps:
13 | - name: Deploy to server
14 | uses: appleboy/ssh-action@master
15 | with:
16 | host: ${{ secrets.HOST }}
17 | username: ${{ secrets.USERNAME }}
18 | port: ${{ secrets.PORT }}
19 | key: ${{ secrets.SSHKEY }}
20 | script: deploy-branch.sh
21 |
--------------------------------------------------------------------------------
/.github/workflows/deploy-to-staging.yml:
--------------------------------------------------------------------------------
1 | name: Deploy to staging
2 |
3 | on:
4 | push:
5 | branches: [ staging ]
6 |
7 | jobs:
8 | build:
9 |
10 | runs-on: ubuntu-20.04
11 |
12 | steps:
13 | - name: Deploy to server (staging)
14 | uses: appleboy/ssh-action@master
15 | with:
16 | host: ${{ secrets.HOST }}
17 | username: ${{ secrets.USERNAME }}
18 | port: ${{ secrets.PORT }}
19 | key: ${{ secrets.STAGING_SSHKEY }}
20 | script: deploy-branch-staging.sh
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Branch Theme
2 |
3 | This is the repo containing the WordPress theme for the Branch magazine site.
4 |
--------------------------------------------------------------------------------
/acf-json/group_60b5f41d4f46f.json:
--------------------------------------------------------------------------------
1 | {
2 | "key": "group_60b5f41d4f46f",
3 | "title": "Home",
4 | "fields": [
5 | {
6 | "key": "field_60b5f423eb770",
7 | "label": "Featured issue",
8 | "name": "featured_issue",
9 | "type": "taxonomy",
10 | "instructions": "",
11 | "required": 0,
12 | "conditional_logic": 0,
13 | "wrapper": {
14 | "width": "",
15 | "class": "",
16 | "id": ""
17 | },
18 | "taxonomy": "issue",
19 | "field_type": "select",
20 | "allow_null": 0,
21 | "add_term": 0,
22 | "save_terms": 0,
23 | "load_terms": 0,
24 | "return_format": "id",
25 | "multiple": 0
26 | }
27 | ],
28 | "location": [
29 | [
30 | {
31 | "param": "page",
32 | "operator": "==",
33 | "value": "228"
34 | }
35 | ]
36 | ],
37 | "menu_order": 0,
38 | "position": "side",
39 | "style": "default",
40 | "label_placement": "top",
41 | "instruction_placement": "label",
42 | "hide_on_screen": "",
43 | "active": true,
44 | "description": "",
45 | "modified": 1622537315
46 | }
--------------------------------------------------------------------------------
/acf-json/group_60b609db674d3.json:
--------------------------------------------------------------------------------
1 | {
2 | "key": "group_60b609db674d3",
3 | "title": "Issues",
4 | "fields": [
5 | {
6 | "key": "field_60b6274b99f47",
7 | "label": "Issue month",
8 | "name": "issue_month",
9 | "type": "text",
10 | "instructions": "",
11 | "required": 0,
12 | "conditional_logic": 0,
13 | "wrapper": {
14 | "width": "",
15 | "class": "",
16 | "id": ""
17 | },
18 | "default_value": "",
19 | "placeholder": "",
20 | "prepend": "",
21 | "append": "",
22 | "maxlength": ""
23 | },
24 | {
25 | "key": "field_60b609e3b72e9",
26 | "label": "Featured image",
27 | "name": "featured_image",
28 | "type": "image",
29 | "instructions": "",
30 | "required": 0,
31 | "conditional_logic": 0,
32 | "wrapper": {
33 | "width": "",
34 | "class": "",
35 | "id": ""
36 | },
37 | "return_format": "array",
38 | "preview_size": "medium",
39 | "library": "all",
40 | "min_width": "",
41 | "min_height": "",
42 | "min_size": "",
43 | "max_width": "",
44 | "max_height": "",
45 | "max_size": "",
46 | "mime_types": ""
47 | },
48 | {
49 | "key": "field_60b60a5183190",
50 | "label": "Featured image caption",
51 | "name": "featured_image_caption",
52 | "type": "wysiwyg",
53 | "instructions": "Ideal for adding a credit for the image artist.",
54 | "required": 0,
55 | "conditional_logic": 0,
56 | "wrapper": {
57 | "width": "",
58 | "class": "",
59 | "id": ""
60 | },
61 | "default_value": "",
62 | "tabs": "all",
63 | "toolbar": "basic",
64 | "media_upload": 1,
65 | "delay": 0
66 | }
67 | ],
68 | "location": [
69 | [
70 | {
71 | "param": "taxonomy",
72 | "operator": "==",
73 | "value": "issue"
74 | }
75 | ]
76 | ],
77 | "menu_order": 0,
78 | "position": "normal",
79 | "style": "default",
80 | "label_placement": "top",
81 | "instruction_placement": "label",
82 | "hide_on_screen": "",
83 | "active": true,
84 | "description": "Taxonomy pages",
85 | "modified": 1622550375
86 | }
--------------------------------------------------------------------------------
/assets/css/selectr.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * Selectr 2.4.13
3 | * http://mobius.ovh/docs/selectr
4 | *
5 | * Released under the MIT license
6 | */
7 | .selectr-container {
8 | position: relative;
9 | display: inline-block;
10 | margin-bottom: -5px;
11 | margin-left: 0.75em;
12 | width: 100%;
13 | }
14 |
15 | @media screen and (min-width: 33em) {
16 | .selectr-container {
17 | width: auto;
18 | }
19 | }
20 |
21 | .selectr-container li {
22 | list-style: none;
23 | }
24 |
25 | .selectr-hidden {
26 | position: absolute;
27 | overflow: hidden;
28 | clip: rect(0px, 0px, 0px, 0px);
29 | width: 1px;
30 | height: 1px;
31 | margin: -1px;
32 | padding: 0;
33 | border: 0 none;
34 | }
35 |
36 | .selectr-visible {
37 | position: absolute;
38 | left: 0;
39 | top: 0;
40 | width: 100%;
41 | height: 100%;
42 | opacity: 0;
43 | z-index: 11;
44 | }
45 |
46 | .selectr-desktop.multiple .selectr-visible {
47 | display: none;
48 | }
49 |
50 | .selectr-desktop.multiple.native-open .selectr-visible {
51 | top: 100%;
52 | min-height: 200px !important;
53 | height: auto;
54 | opacity: 1;
55 | display: block;
56 | }
57 |
58 | .selectr-container.multiple.selectr-mobile .selectr-selected {
59 | z-index: 0;
60 | }
61 |
62 | .selectr-selected {
63 | position: relative;
64 | z-index: 1;
65 | box-sizing: border-box;
66 | width: 100%;
67 | cursor: pointer;
68 | }
69 |
70 | .selectr-selected::before {
71 | position: absolute;
72 | top: 40%;
73 | right: 0;
74 | width: 0;
75 | height: 0;
76 | content: '';
77 | -o-transform: rotate(0deg) translate3d(0px, -50%, 0px);
78 | -ms-transform: rotate(0deg) translate3d(0px, -50%, 0px);
79 | -moz-transform: rotate(0deg) translate3d(0px, -50%, 0px);
80 | -webkit-transform: rotate(0deg) translate3d(0px, -50%, 0px);
81 | transform: rotate(0deg) translate3d(0px, -50%, 0px);
82 | border-width: 10px 5px 0 5px;
83 | border-style: solid;
84 | border-color: #212121 transparent transparent;
85 | }
86 |
87 | .selectr-container.open .selectr-selected::before,
88 | .selectr-container.native-open .selectr-selected::before {
89 | border-width: 0 4px 4px 4px;
90 | border-style: solid;
91 | border-color: transparent transparent #6c7a86;
92 | }
93 |
94 | .selectr-label {
95 | display: none;
96 | overflow: hidden;
97 | white-space: nowrap;
98 | text-overflow: ellipsis;
99 | padding-left: 5px;
100 | padding-right: 15px;
101 | position: relative;
102 | border-bottom: solid 3px var(--hl-colour);
103 | }
104 |
105 | .selectr-placeholder {
106 | color: #6c7a86;
107 | }
108 |
109 | .selectr-tags {
110 | margin: 0;
111 | padding: 0;
112 | white-space: normal;
113 | }
114 |
115 | .has-selected .selectr-tags {
116 | margin: 0 0 -2px;
117 | }
118 |
119 | .selectr-tag {
120 | list-style: none;
121 | position: relative;
122 | float: left;
123 | padding: 2px 25px 2px 8px;
124 | margin: 0 2px 2px 0;
125 | cursor: default;
126 | color: #fff;
127 | border: medium none;
128 | border-radius: 10px;
129 | background: #acb7bf none repeat scroll 0 0;
130 | }
131 |
132 | .selectr-container.multiple.has-selected .selectr-selected {
133 | padding: 5px 28px 5px 5px;
134 | }
135 |
136 | .selectr-options-container {
137 | position: absolute;
138 | z-index: 10000;
139 | top: calc(100% + 1.2em ); /* Same as vertical padding on ssecondary nav bar */
140 | right: 0;
141 | display: none;
142 | box-sizing: border-box;
143 | min-width: 260px;
144 | border-width: 0 1px 1px;
145 | border-style: solid;
146 | border-color: transparent #999 #999;
147 | border-radius: 0 0 3px 3px;
148 | background-color: var(--bg-colour);
149 | }
150 |
151 | .selectr-container.open .selectr-options-container {
152 | display: block;
153 | }
154 |
155 | .selectr-input-container {
156 | position: relative;
157 | display: none;
158 | }
159 |
160 | .selectr-clear,
161 | .selectr-input-clear,
162 | .selectr-tag-remove {
163 | position: absolute;
164 | top: 50%;
165 | right: 22px;
166 | width: 20px;
167 | height: 20px;
168 | padding: 0;
169 | cursor: pointer;
170 | -o-transform: translate3d(0px, -50%, 0px);
171 | -ms-transform: translate3d(0px, -50%, 0px);
172 | -moz-transform: translate3d(0px, -50%, 0px);
173 | -webkit-transform: translate3d(0px, -50%, 0px);
174 | transform: translate3d(0px, -50%, 0px);
175 | border: medium none;
176 | background-color: transparent;
177 | z-index: 11;
178 | }
179 |
180 | .selectr-clear,
181 | .selectr-input-clear {
182 | display: none;
183 | }
184 |
185 | .selectr-container.has-selected .selectr-clear,
186 | .selectr-input-container.active .selectr-input-clear {
187 | display: block;
188 | }
189 |
190 | .selectr-selected .selectr-tag-remove {
191 | right: 2px;
192 | }
193 |
194 | .selectr-clear::before,
195 | .selectr-clear::after,
196 | .selectr-input-clear::before,
197 | .selectr-input-clear::after,
198 | .selectr-tag-remove::before,
199 | .selectr-tag-remove::after {
200 | position: absolute;
201 | top: 5px;
202 | left: 9px;
203 | width: 2px;
204 | height: 10px;
205 | content: ' ';
206 | background-color: #6c7a86;
207 | }
208 |
209 | .selectr-tag-remove::before,
210 | .selectr-tag-remove::after {
211 | top: 4px;
212 | width: 3px;
213 | height: 12px;
214 | background-color: #fff;
215 | }
216 |
217 | .selectr-clear:before,
218 | .selectr-input-clear::before,
219 | .selectr-tag-remove::before {
220 | -o-transform: rotate(45deg);
221 | -ms-transform: rotate(45deg);
222 | -moz-transform: rotate(45deg);
223 | -webkit-transform: rotate(45deg);
224 | transform: rotate(45deg);
225 | }
226 |
227 | .selectr-clear:after,
228 | .selectr-input-clear::after,
229 | .selectr-tag-remove::after {
230 | -o-transform: rotate(-45deg);
231 | -ms-transform: rotate(-45deg);
232 | -moz-transform: rotate(-45deg);
233 | -webkit-transform: rotate(-45deg);
234 | transform: rotate(-45deg);
235 | }
236 |
237 | .selectr-input-container.active,
238 | .selectr-input-container.active .selectr-clear {
239 | display: block;
240 | }
241 |
242 | .selectr-input {
243 | top: 5px;
244 | left: 5px;
245 | box-sizing: border-box;
246 | width: calc(100% - 30px);
247 | margin: 10px 15px;
248 | padding: 7px 30px 7px 9px;
249 | border: 1px solid #999;
250 | border-radius: 3px;
251 | }
252 |
253 | .selectr-notice {
254 | display: none;
255 | box-sizing: border-box;
256 | width: 100%;
257 | padding: 8px 16px;
258 | border-top: 1px solid #999;
259 | border-radius: 0 0 3px 3px;
260 | background-color: #fff;
261 | }
262 |
263 | .selectr-container.notice .selectr-notice {
264 | display: block;
265 | }
266 |
267 | .selectr-container.notice .selectr-selected {
268 | border-radius: 3px 3px 0 0;
269 | }
270 |
271 | .selectr-options {
272 | position: relative;
273 | top: calc(100% + 2px);
274 | display: none;
275 | overflow-x: auto;
276 | overflow-y: scroll;
277 | /* max-height: 200px; */
278 | margin: 0;
279 | padding: 0;
280 | }
281 |
282 | .selectr-container.open .selectr-options,
283 | .selectr-container.open .selectr-input-container,
284 | .selectr-container.notice .selectr-options-container {
285 | display: block;
286 | }
287 |
288 | .selectr-option {
289 | position: relative;
290 | display: block;
291 | padding: 1.2em;
292 | list-style: outside none none;
293 | cursor: pointer;
294 | font-weight: normal;
295 | border-top: 1px solid #999;
296 | }
297 |
298 | .selectr-options.optgroups > .selectr-option {
299 | padding-left: 25px;
300 | }
301 |
302 | .selectr-optgroup {
303 | font-weight: bold;
304 | padding: 0;
305 | }
306 |
307 | .selectr-optgroup--label {
308 | font-weight: bold;
309 | margin-top: 10px;
310 | padding: 5px 15px;
311 | }
312 |
313 | .selectr-match {
314 | text-decoration: underline;
315 | }
316 |
317 | .selectr-option.selected {
318 | color: #fff;
319 | background-color: var(--hl-colour);
320 | }
321 |
322 | .selectr-option.active {
323 | color: #fff;
324 | background-color: #111;
325 | }
326 |
327 | .selectr-option.disabled {
328 | opacity: 0.4;
329 | }
330 |
331 | .selectr-option.excluded {
332 | display: none;
333 | }
334 |
335 | .selectr-container.open .selectr-selected {
336 | border-color: #999 #999 transparent #999;
337 | border-radius: 3px 3px 0 0;
338 | }
339 |
340 | .selectr-container.open .selectr-selected::after {
341 | -o-transform: rotate(180deg) translate3d(0px, 50%, 0px);
342 | -ms-transform: rotate(180deg) translate3d(0px, 50%, 0px);
343 | -moz-transform: rotate(180deg) translate3d(0px, 50%, 0px);
344 | -webkit-transform: rotate(180deg) translate3d(0px, 50%, 0px);
345 | transform: rotate(180deg) translate3d(0px, 50%, 0px);
346 | }
347 |
348 | .selectr-disabled {
349 | opacity: .6;
350 | }
351 |
352 | .selectr-empty,
353 | .has-selected .selectr-placeholder {
354 | display: none;
355 | }
356 |
357 | .has-selected .selectr-label {
358 | display: inline-block;
359 | }
360 |
361 | /* TAGGABLE */
362 | .taggable .selectr-selected {
363 | padding: 4px 28px 4px 4px;
364 | }
365 |
366 | .taggable .selectr-selected::after {
367 | display: table;
368 | content: " ";
369 | clear: both;
370 | }
371 |
372 | .taggable .selectr-label {
373 | width: auto;
374 | }
375 |
376 | .taggable .selectr-tags {
377 | float: left;
378 | display: block;
379 | }
380 |
381 | .taggable .selectr-placeholder {
382 | display: none;
383 | }
384 |
385 | .input-tag {
386 | float: left;
387 | min-width: 90px;
388 | width: auto;
389 | }
390 |
391 | .selectr-tag-input {
392 | border: medium none;
393 | padding: 3px 10px;
394 | width: 100%;
395 | font-family: inherit;
396 | font-weight: inherit;
397 | font-size: inherit;
398 | }
399 |
400 | .selectr-input-container.loading::after {
401 | position: absolute;
402 | top: 50%;
403 | right: 20px;
404 | width: 20px;
405 | height: 20px;
406 | content: '';
407 | -o-transform: translate3d(0px, -50%, 0px);
408 | -ms-transform: translate3d(0px, -50%, 0px);
409 | -moz-transform: translate3d(0px, -50%, 0px);
410 | -webkit-transform: translate3d(0px, -50%, 0px);
411 | transform: translate3d(0px, -50%, 0px);
412 |
413 | -o-transform-origin: 50% 0 0;
414 | -ms-transform-origin: 50% 0 0;
415 | -moz-transform-origin: 50% 0 0;
416 | -webkit-transform-origin: 50% 0 0;
417 | transform-origin: 50% 0 0;
418 |
419 | -moz-animation: 500ms linear 0s normal forwards infinite running spin;
420 | -webkit-animation: 500ms linear 0s normal forwards infinite running spin;
421 | animation: 500ms linear 0s normal forwards infinite running spin;
422 | border-width: 3px;
423 | border-style: solid;
424 | border-color: #aaa #ddd #ddd;
425 | border-radius: 50%;
426 | }
427 |
428 | @-webkit-keyframes spin {
429 | 0% {
430 | -webkit-transform: rotate(0deg) translate3d(0px, -50%, 0px);
431 | transform: rotate(0deg) translate3d(0px, -50%, 0px);
432 | }
433 | 100% {
434 | -webkit-transform: rotate(360deg) translate3d(0px, -50%, 0px);
435 | transform: rotate(360deg) translate3d(0px, -50%, 0px);
436 | }
437 | }
438 | @keyframes spin {
439 | 0% {
440 | -webkit-transform: rotate(0deg) translate3d(0px, -50%, 0px);
441 | transform: rotate(0deg) translate3d(0px, -50%, 0px);
442 | }
443 | 100% {
444 | -webkit-transform: rotate(360deg) translate3d(0px, -50%, 0px);
445 | transform: rotate(360deg) translate3d(0px, -50%, 0px);
446 | }
447 | }
448 | .selectr-container.open.inverted .selectr-selected {
449 | border-color: transparent #999 #999;
450 | border-radius: 0 0 3px 3px;
451 | }
452 |
453 | .selectr-container.inverted .selectr-options-container {
454 | border-width: 1px 1px 0;
455 | border-color: #999 #999 transparent;
456 | border-radius: 3px 3px 0 0;
457 | background-color: #fff;
458 | }
459 |
460 | .selectr-container.inverted .selectr-options-container {
461 | top: auto;
462 | bottom: calc(100% - 1px);
463 | }
464 |
465 | .selectr-container ::-webkit-input-placeholder {
466 | color: #6c7a86;
467 | opacity: 1;
468 | }
469 |
470 | .selectr-container ::-moz-placeholder {
471 | color: #6c7a86;
472 | opacity: 1;
473 | }
474 |
475 | .selectr-container :-ms-input-placeholder {
476 | color: #6c7a86;
477 | opacity: 1;
478 | }
479 |
480 | .selectr-container ::placeholder {
481 | color: #6c7a86;
482 | opacity: 1;
483 | }
484 |
--------------------------------------------------------------------------------
/assets/js/intensity-toggle.js:
--------------------------------------------------------------------------------
1 | /**
2 | * JS functions that power the grid intensity toggle functionality.
3 | */
4 |
5 |
6 |
7 | tippy('#tooltip', {
8 | content: 'This site changes its design based on the quantity of fossil fuels on the grid to stay inside a carbon budget at all times. Learn more',
9 | allowHTML: true,
10 | interactive: true,
11 | });
12 |
13 |
14 | /**
15 | * Initialise the select box styling framework.
16 | * We're using Selectr: https://github.com/Mobius1/Selectr
17 | * It was the only non JQuery plugin I could find, but sadly its not under active dev anymore.
18 | */
19 |
20 | let intensities = [
21 | { value: 'live', text: 'live' },
22 | { value: 'low', text: 'low' },
23 | { value: 'moderate', text: 'moderate' },
24 | { value: 'high', text: 'high' }
25 | ]
26 |
27 | const selectedIntensity = getWithExpiry( 'selected-intensity' );
28 |
29 | intensities.forEach(intensity => {
30 | if (!selectedIntensity && 'live' == intensity.value) {
31 | intensity['selected'] = true;
32 | } else if (selectedIntensity == intensity.value) {
33 | intensity['selected'] = true;
34 | }
35 | });
36 |
37 | var selector = new Selectr( '#carbon-switcher-toggle', {
38 | data: intensities,
39 | defaultSelected: false,
40 | searchable: false,
41 | width: 260
42 | });
43 |
44 | // Attach event listener to the select element.
45 | selector.on('selectr.select', async function(option) {
46 |
47 | // Change the intensity back to the live value.
48 | if ( option.value === 'live' ) {
49 |
50 | // Set to immediately expire, which means on reload the core way it fetches intensity is used instead.
51 | setWithExpiry( 'grid-intensity', 'unset', 0 );
52 | setWithExpiry( 'selected-intensity', 'unset', 0 );
53 | location.reload();
54 |
55 | } else {
56 | // Change the intensity to another user selected intensity.
57 | setWithExpiry( 'grid-intensity', option.value, 3600000 );
58 | setWithExpiry( 'selected-intensity', option.value, 3600000 );
59 | location.reload();
60 | }
61 | });
62 |
--------------------------------------------------------------------------------
/fonts/Rubik-Bold-Extra.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/climateaction-tech/branch-theme/25525c50b081482d9165791ce99ad037c5f87230/fonts/Rubik-Bold-Extra.woff2
--------------------------------------------------------------------------------
/fonts/Rubik-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/climateaction-tech/branch-theme/25525c50b081482d9165791ce99ad037c5f87230/fonts/Rubik-Bold.ttf
--------------------------------------------------------------------------------
/fonts/Rubik-Bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/climateaction-tech/branch-theme/25525c50b081482d9165791ce99ad037c5f87230/fonts/Rubik-Bold.woff2
--------------------------------------------------------------------------------
/footer.php:
--------------------------------------------------------------------------------
1 |
13 |
14 |
24 |
25 |
26 |
27 |
28 |