Skip to content

Commit ab8ce75

Browse files
committed
Merge release v1.47.4
2 parents f9eb536 + e2255a6 commit ab8ce75

19 files changed

+14067
-13242
lines changed

README.md

Lines changed: 162 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,165 @@
1-
# Greenpeace Planet 4 Child Theme for GP Nordic
1+
c# Greenpeace Planet 4 Nordic Child Theme
22

3-
Child theme for the Planet 4 Wordpress project.
4-
The related master theme’s code lives at:
3+
The **Planet 4 Nordic Child Theme** is a child theme built for the [Planet 4](https://www.greenpeace.org) project. It customizes the parent theme by adding unique features and styles specific to the Nordic region. This child theme customisez the [Planet4 Master Theme](https://github.com/greenpeace/planet4-master-theme) following this [Design System](https://zeroheight.com/05f6e9516/p/76cd7b-planet-4-design-system).
54

6-
https://github.com/greenpeace/planet4-master-theme.
5+
## Table of Contents
6+
- [Installation](#installation)
7+
- [Usage](#usage)
8+
- [Development](#development)
9+
- [File Structure](#file-structure)
10+
- [Coding Standards](#coding-standards)
11+
- [Contributing](#contributing)
12+
- [License](#license)
13+
14+
## Prerequisites
15+
16+
Make sure you have the following tools installed on your machine:
17+
18+
- [Node.js](https://nodejs.org/en/) (v16 recommended)
19+
- [npm](https://www.npmjs.com/) (comes with Node.js)
20+
- [Composer](https://getcomposer.org/) (for PHP dependencies and coding standards)
21+
- [WordPress](https://wordpress.org/) setup (parent theme and WordPress installation)
22+
23+
## Installation
24+
25+
To install and set up the theme locally, follow these steps:
26+
27+
1. **Clone the repository**:
28+
29+
```bash
30+
git clone https://github.com/greenpeace/planet4-child-theme-nordic.git
31+
```
32+
33+
2. **Navigate to the theme directory**:
34+
35+
```bash
36+
cd planet4-nordic-child-theme
37+
```
38+
39+
3. **Install the npm dependencies**:
40+
41+
Run `npm install` to install all necessary Node.js packages:
42+
43+
```bash
44+
npm install
45+
```
46+
47+
4. **Install Composer dependencies**:
48+
49+
Run `composer install` to install PHP dependencies (like coding standards):
50+
51+
```bash
52+
composer install
53+
```
54+
55+
5. **Activate the theme**:
56+
57+
- Upload the child theme to your WordPress `/wp-content/themes` directory.
58+
- Activate the theme from the WordPress admin dashboard (`Appearance > Themes`).
59+
60+
## Usage
61+
62+
Once installed, the theme can be customized and extended as per the needs of the Nordic campaign. The child theme inherits most of its functionality from the parent theme, but you can add custom styles, templates, and features as needed.
63+
64+
To modify or add features to the theme, navigate to the `planet4-nordic-child-theme` directory, make changes to the appropriate files, and use the provided npm scripts for development.
65+
66+
## Development
67+
68+
### Available npm Scripts
69+
70+
- **Build CSS**: Compiles the SCSS files into a minified CSS file.
71+
72+
```bash
73+
npm run build:css
74+
```
75+
76+
- **Build**: Compiles all assets for production using Webpack and outputs them to the `build/` directory.
77+
78+
```bash
79+
npm run build
80+
```
81+
82+
- **Start**: Launches a development server with live reloading and builds assets in development mode.
83+
84+
```bash
85+
npm run start
86+
```
87+
88+
- **Lint CSS**: Lints the SCSS files to ensure coding standards are followed.
89+
90+
```bash
91+
npm run lint:css
92+
```
93+
94+
### Composer Scripts for PHP Code Standards
95+
96+
- **Fixes**: Automatically fixes PHP code style issues.
97+
98+
```bash
99+
composer run fixes
100+
```
101+
102+
- **Sniffs**: Runs PHP CodeSniffer (`phpcs`) to check PHP files against coding standards.
103+
104+
```bash
105+
composer run sniffs
106+
```
107+
108+
## File Structure
109+
110+
Here's a brief overview of the key directories and files in the project:
111+
112+
```plaintext
113+
planet4-nordic-child-theme/
114+
├── assets/ # Compiled theme assets (CSS, JS)
115+
│ ├── build/ # Output directory for compiled and minified production assets
116+
│ └── src/ # Source SCSS and JS files
117+
├── includes/ # Theme-specific PHP includes
118+
├── page-templates/ # Theme-specific Twig templates
119+
├── vendor/ # Composer dependencies
120+
├── functions.php # Main theme functions
121+
├── webpack.config.js # Webpack configuration for asset bundling
122+
├── style.css # Main stylesheet (import parent theme styles)
123+
├── package.json # Node.js dependencies and npm scripts
124+
├── composer.json # PHP dependencies and Composer scripts
125+
└── README.md # Project documentation (this file)
126+
```
127+
128+
### Customization
129+
130+
To override parent theme styles, place your custom SCSS files in the `assets/src/scss/` directory. These files are automatically compiled and output to `assets/build/` when running the build scripts.
131+
132+
### Coding Standards
133+
134+
We follow [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/) to ensure clean, readable, and maintainable code.
135+
136+
The coding standards are enforced through `phpcs` (PHP CodeSniffer) and can be automatically corrected using `phpcbf`. Composer handles both tools.
137+
138+
To check for coding standard violations:
139+
140+
```bash
141+
composer run sniffs
142+
```
143+
144+
To automatically fix issues:
145+
146+
```bash
147+
composer run fixes
148+
```
149+
150+
## Contributing
151+
152+
We welcome contributions! To contribute to this project:
153+
154+
1. Fork the repository.
155+
2. Create a new branch (`git checkout -b feat/my-feature`).
156+
3. Make your changes.
157+
4. Push your branch (`git push origin feat/my-feature`).
158+
5. Open a Pull Request.
159+
160+
Please ensure that your code follows the project's coding standards. Use `npm run lint:css` for CSS and `composer run sniffs` for PHP.
161+
162+
163+
## License
164+
This project is licensed under the [GNU License](LICENSE). See the LICENSE file for details.
7165

8-
Please check the master theme code for more information.

assets/build/index.js

Lines changed: 1 addition & 777 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/build/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/build/style.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/build/style.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/src/js/app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import '../scss/style.scss';
2+
13
//import $ from the global scope
24
import $ from 'jquery';
5+
// import 'core-js/stable'; // for polyfills
6+
37
// Expose jQuery to the global object
48
window.$ = $ || jQuery;
59
window.dataLayer = window.dataLayer || [];

assets/src/scss/base/_typography.scss

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ strong>a {
203203
border-bottom: 3px solid $gp-green-50;
204204
text-decoration: none;
205205
box-shadow: none;
206+
background-image: none;
206207
}
207208
}
208209

@@ -245,15 +246,31 @@ a.external-link {
245246
margin-right: 0.3rem;
246247
}
247248

248-
//deep-dive, issues pattern
249-
.is-pattern-p4-issues .wp-block-group.container.is-layout-flow h5.wp-block-heading a:hover,
250-
.wp-block-group.group-stretched-link.is-layout-flow>h5.wp-block-heading>a:hover,
251-
.wp-block-group.group-stretched-link.is-layout-flow>h5.wp-block-heading>strong>a:hover {
252-
text-decoration: none;
253-
box-shadow: none;
254-
color: $gp-green-80;
249+
.wp-block-heading > a,
250+
.secondary-menu > a,
251+
.wp-block-heading.is-style-chevron > a,
252+
.group-stretched-link > .wp-block-heading > a {
253+
color: inherit;
254+
background-image: none;
255+
background-repeat: no-repeat;
256+
border-bottom: none;
257+
&:hover {
258+
// border-bottom: 1.5px solid $gp-green-50;
259+
color: $gp-green-60!important;
260+
}
255261
}
256262

263+
//deep-dive, issues pattern
264+
// .is-pattern-p4-issues .wp-block-heading a:hover,
265+
// .is-pattern-p4-deep-dive .wp-block-heading a:hover,
266+
// .group-stretched-link>.wp-block-heading>a:hover,
267+
// .group-stretched-link>.wp-block-heading>strong>a:hover
268+
// {
269+
// text-decoration: underline;
270+
// box-shadow: none;
271+
// color: $gp-green-80;
272+
// }
273+
257274
//headings on dynamic blocks
258275
h2.page-section-header {
259276
color: $black;

assets/src/scss/components/_articles.scss

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ a[data-ga-action="Navigation Tag"],
1313
.wrapper-post-tag a,
1414
a[data-ga-action="Post Type Tag"],
1515
a[data-ga-action="Post Type Tag"] span,
16-
a.tag-item.tag-item--main {
16+
a.tag-item.tag-item--main,
17+
.taxonomy-category a {
1718
font-family: $gp-sans;
1819
color: $gp-green-80;
1920
font-weight: 500;
@@ -59,22 +60,46 @@ a.btn.post-tag-button span:nth-child(2) {
5960

6061
//article meta
6162
.query-list-item-meta,
62-
.article-list-item-meta {
63+
.article-list-item-meta,
64+
.posts-list-meta {
6365

6466
span.article-list-item-author,
65-
span.article-list-item-author a {
67+
span.article-list-item-author a,
68+
.wp-block-post-author-name a {
6669
font-family: $gp-sans;
6770
color: $grey-70;
6871
font-weight: var(--font-weight-regular);
6972
}
7073
}
7174

75+
.article-list-item-author,
76+
.taxonomy-category a {
77+
font-family: $gp-sans;
78+
font-weight: var(--font-weight-regular) !important;
79+
80+
a:hover {
81+
-webkit-transition: height 0.2s cubic-bezier(.5, 0, 0, 1);
82+
-o-transition: height 0.2s cubic-bezier(.5, 0, 0, 1);
83+
-moz-transition: height 0.2s cubic-bezier(.5, 0, 0, 1);
84+
transition: height 0.2s cubic-bezier(.5, 0, 0, 1);
85+
border-bottom: 2px solid $gp-green-50;
86+
text-decoration: none!important;
87+
box-shadow: none;
88+
}
89+
}
90+
91+
.posts-list .article-list-item-author::after,
92+
.posts-list .wp-block-post-author-name::after {
93+
margin-top: -15px;
94+
}
95+
7296
//post info preview
7397
a.tag-item.tag,
7498
.single-post-time,
7599
a.comment-link,
76100
a.comment-link>span.quiantity,
77-
a.comment-link>span.display-text {
101+
a.comment-link>span.display-text,
102+
a.external-link {
78103
font-weight: 400;
79104

80105
&:hover {
@@ -90,21 +115,6 @@ a.comment-link>span.display-text {
90115
}
91116
}
92117

93-
.article-list-item-author {
94-
font-family: $gp-sans;
95-
font-weight: var(--font-weight-regular) !important;
96-
97-
a:hover {
98-
-webkit-transition: height 0.2s cubic-bezier(.5, 0, 0, 1);
99-
-o-transition: height 0.2s cubic-bezier(.5, 0, 0, 1);
100-
-moz-transition: height 0.2s cubic-bezier(.5, 0, 0, 1);
101-
transition: height 0.2s cubic-bezier(.5, 0, 0, 1);
102-
border-bottom: 2px solid $gp-green-50;
103-
text-decoration: none;
104-
box-shadow: none;
105-
}
106-
}
107-
108118
//on listing pages
109119
div.query-list-item-post-terms div.taxonomy-p4-page-type a[rel="tag"],
110120
div.wrapper-post-tag div.taxonomy-post_tag.wp-block-post-terms a[rel="tag"],
@@ -127,9 +137,12 @@ div.query-list-item-body div.query-list-item-post-terms div.wrapper-post-term di
127137

128138
}
129139

130-
//on listing pages
131-
.query-list-item-headline.wp-block-post-title a {
140+
//on listing pages & included articles
141+
.query-list-item-headline.wp-block-post-title a,
142+
.wp-block-query.posts-list.p4-query-loop .wp-block-post-title a,
143+
h2.wp-block-post-title a {
132144
color: $black;
145+
font-weight: 700;
133146

134147
&:hover {
135148
border-bottom: none;
@@ -138,6 +151,13 @@ div.query-list-item-body div.query-list-item-post-terms div.wrapper-post-term di
138151
}
139152
}
140153

154+
//on single posts
155+
.wp-block-post-title {
156+
@include x-large-and-up {
157+
margin-bottom: 24px;
158+
}
159+
}
160+
141161

142162
div.wrapper-post-tag ::before,
143163
.query-list-item-body:has(.taxonomy-p4-page-type):has(.taxonomy-post_tag) .wrapper-post-tag:before {

assets/src/scss/components/_body.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,10 @@ li.search-result-list-item:hover {
5252
//editor page layouts
5353
.block-editor-block-patterns-list__item[role="option"] {
5454
height: auto !important;
55+
}
56+
57+
.page-content p:not(.article-list-item-meta) a,
58+
.page-content>ol li a,
59+
.page-content>ul li a {
60+
background-image: none !important;
5561
}

assets/src/scss/components/_footer.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,22 @@
77
background: $gp-nor-green;
88
font-family: var(--headings--font-family);
99

10-
.country-selector-toggle {
10+
.footer-menu ul {
11+
width: 100%;
12+
text-align: start;
13+
column-count: 1;
14+
15+
@include medium-and-up {
16+
font-size: $font-size-md;
17+
column-count: 2;
18+
}
19+
20+
@include large-and-up {
21+
column-count: 3;
22+
}
23+
}
1124

25+
.country-selector-toggle {
1226
&:hover,
1327
&:active {
1428
text-decoration: none !important;

0 commit comments

Comments
 (0)